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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mario_mirabile
Contributor
Contributor

TalendDate format string for timestamp with timezone

Hi
I have the following code in a tMap - TalendDate.parseDate("yyyy-MM-dd'T'hh:mm:ssz", stgTVP6.MOMENT ) .
When it runs, I get the following error
java.lang.RuntimeException: java.text.ParseException: Unparseable date: "2004-08-12T00:00:00+09:30"
Can someone help me with the correct format string for a timestamp string with the format "2004-08-12T00:00:00+09:30".
Thanks
Mario
Labels (3)
7 Replies
Anonymous
Not applicable

try this one
String date = "2004-08-12T00:00:00+09:30".replaceAll("\\+0(){1}\\:00", "+0$100");
System.out.println( TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ssZ", date));
mario_mirabile
Contributor
Contributor
Author

Thanks, but I'm still getting exactly the same error. When I check the effect of the replaceAll on the input value, it hasn't changed the input string at all.
I'm not very good at regular expressions - what are you trying to replace, and with what?
alevy
Specialist
Specialist

"z" in a date format string is e.g. GMT, PST. "Z" in a date format string is a time offset e.g. +1000. So you should just need to get rid of the ":" in the time offset and change your date format string to use "Z".
Try:
TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ssZ", stgTVP6.MOMENT.replaceAll(" 0683p000009MPcz.png\\d{2})$","$1"));
mario_mirabile
Contributor
Contributor
Author

Thanks.
That worked insofar as as making the timestamp value palatable to Talend. The problem is that ParseDate now insists on converting the time zone from +9:30 (South Australia) to Eastern European time!!
alevy
Specialist
Specialist

How do you mean?
mario_mirabile
Contributor
Contributor
Author

I mean that if I give it a value of "2013-06-16T10:00:00+09:30", I get back a value of "2013-06-16T03:00:00+0300" - both effectively the same time, but one is in Adelaide and the other in Eastern Europe - possibly Prague, but it could be Budapest.
alevy
Specialist
Specialist

I can only imagine that the machine you're running the job on thinks it's in the +3 timezone.