Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey,
I have a string with date "17-03-19 9:05" and I want to change the format to "yyyy-MM-dd HH:mm:ss" and the type to be string.
Also I want to convecrt 'May 20 2019 15:30:02 GST" to "yyyy-MM-dd HH:mm:ss"
Please help me.Thanks.
This code will do it....
String strDate = "May 20 2019 15:30:02 GST "; Date date = routines.TalendDate.parseDate("MMM dd yyyy HH:mm:ss z", strDate); System.out.println(strDate); System.out.println(routines.TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", date));
This page will make figuring this sort of stuff out a bit easier.....
https://docs.oracle.com/javase/10/docs/api/java/text/SimpleDateFormat.html
You will need to use the TalendDate routines for this (....or use standard Java Date functionality...but the TalendDate routines make it easier). These are described here....
https://help.talend.com/reader/QrWkwPvKmKybs~JNLeBt3Q/GF6kKOHdJwnnbGY_b6u02g
I figure it out how to do the first one but I need help with the second "May 20 2019 15:30:02 GST "
This code will do it....
String strDate = "May 20 2019 15:30:02 GST "; Date date = routines.TalendDate.parseDate("MMM dd yyyy HH:mm:ss z", strDate); System.out.println(strDate); System.out.println(routines.TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", date));
This page will make figuring this sort of stuff out a bit easier.....
https://docs.oracle.com/javase/10/docs/api/java/text/SimpleDateFormat.html