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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
MattE
Creator II
Creator II

datetime string to date

Hi,

I've got a column in a database which is a string like this

Tue May 11 2021 00:15:17 GMT+0000 (UTC)

and i want to turn this into a date like

2021-05-11 00:15:17

Is there any prebuilt function to do this?

Thanks

Labels (2)
1 Solution

Accepted Solutions
gjeremy1617088143

You have to find the good pattern :

https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

View solution in original post

5 Replies
MattE
Creator II
Creator II
Author

I've tried them all but can't find one which doesn't throw an error converting

 

Tue May 11 2021 00:15:17 GMT+0000 (UTC) into 2021-05-11 00:15:17

 

gjeremy1617088143

You have to find the good pattern :

https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

MattE
Creator II
Creator II
Author

Thanks @guenneguez jeremy​  you set me on the right path. In the end i had to get rid of the text at the end and use the right pattern

 

TalendDate.parseDate("E MMM dd yyyy HH:mm:ss",redemption.transaction_date.substring(0, redemption_rakuten.transaction_date.indexOf("GMT")).trim())

gjeremy1617088143

Glad you find by yourself