Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Jay-IRT
Partner - Contributor
Partner - Contributor

Date format to DD/MM/YYYY

 

 

1083216:18:28 AM  

 

How do I change the above format to DD/MM/YYYY   ?

Labels (2)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

If we can assume that this is a timestamp on the format 

hh:mm:ss TT then we can use that in order to present it as a date in tree steps. 

dayname(timestamp#( subfield('1083216:18:28 AM',' '), 'hh:mm:ss'))

1:  subfield('1083216:18:28 AM',' ') picks out the timestamp excluding the AM/PM info. This part fill return '1083216:18:28'

2: timestamp#([...], 'hh:mm:ss') inerprets the string value as a timestamp in the 'hh:mm:ss' format (or in your case its more like 'hhhhhhh:mm:ss'. The output of this is now intepreted as a timestamp, but presented as it is written  '1083216:18:28'

3: dayname([...])  converts the timestamp into a date value and presents it as a date according to your application's default pattern. This step returns a date, having DD/MM/YYYY as default formating returns  27/07/2023 

3 (Alternative method) Date(Floor([...]), 'DD/MM/YYYY')

 

Vegar_1-1712820411973.png

 

 

View solution in original post

3 Replies
Vegar
MVP
MVP

What are you expecting to see with that timestamp?

Do you know from which source you are fetching it?

 

Vegar
MVP
MVP

If we can assume that this is a timestamp on the format 

hh:mm:ss TT then we can use that in order to present it as a date in tree steps. 

dayname(timestamp#( subfield('1083216:18:28 AM',' '), 'hh:mm:ss'))

1:  subfield('1083216:18:28 AM',' ') picks out the timestamp excluding the AM/PM info. This part fill return '1083216:18:28'

2: timestamp#([...], 'hh:mm:ss') inerprets the string value as a timestamp in the 'hh:mm:ss' format (or in your case its more like 'hhhhhhh:mm:ss'. The output of this is now intepreted as a timestamp, but presented as it is written  '1083216:18:28'

3: dayname([...])  converts the timestamp into a date value and presents it as a date according to your application's default pattern. This step returns a date, having DD/MM/YYYY as default formating returns  27/07/2023 

3 (Alternative method) Date(Floor([...]), 'DD/MM/YYYY')

 

Vegar_1-1712820411973.png

 

 

Jay-IRT
Partner - Contributor
Partner - Contributor
Author

Thank you it worked for me !