Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert Time in string format to 24 hour format

Hello Everyone,

 

Need help on this !!

 

I am trying to convert a time of type string into a date of 24 hour format.

 

Input string : "11:59:00 PM"

Tmap Expression : "TalendDate.parseDate("HH:mm:ss", row6.Start_Time) 

Output date 11:59:00.0000000

Expected: 23:59:00.0000000

 

 

Labels (2)
1 Solution

Accepted Solutions
cterenzi
Specialist
Specialist

"HH" in a date format string implies 24 hour time. If you have AM/PM in your strings, use "hh".

As for the output, once your string is converted to a Date object, you can format the output however you want. If you need to print the date, you can use TalendDate.formatDate() for that. You can also influence the output format by setting the Date Pattern for that column in your schema. In that case, you'd want the pattern to be "HH:mm:ss" to print 24 hour time.

View solution in original post

4 Replies
cterenzi
Specialist
Specialist

Your date pattern needs to be "hh:mm:ss a" to capture the AM/PM designation.
Anonymous
Not applicable
Author

Thank you for your reply. I tried that and it still doesn't convert to 24 hour format.

TalendDate.parseDate("HH:mm:ss a",row3.Start_Time )

cterenzi
Specialist
Specialist

"HH" in a date format string implies 24 hour time. If you have AM/PM in your strings, use "hh".

As for the output, once your string is converted to a Date object, you can format the output however you want. If you need to print the date, you can use TalendDate.formatDate() for that. You can also influence the output format by setting the Date Pattern for that column in your schema. In that case, you'd want the pattern to be "HH:mm:ss" to print 24 hour time.
Anonymous
Not applicable
Author

worked !! Missed that in your first note 0683p000009MACn.png Thank you so much. Appreciate it.