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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
DrGenious
Creator
Creator

Timestamp with UTC

HI,

 

I have a column with strings like "2019-03-17 06:15:00 +0400". How can I add  +0400 into the time?  For example  "2019-03-17 10:15:00"

 

Thanks a lot .

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

This is all about timezones and it can get very confusing. But essentially, what you appear to be wanting to do is to use UTC as your timezone. There are a couple of methods that Talend provide for this, but first you need to know how your data is being stored. If it is being stored as a String, then it is relatively easy. You can use code similar to below.....

 

String myDate = "2019-03-17 06:15:00 +0400";

Date d = routines.TalendDate.parseDate("yyyy-MM-dd HH:mm:ss X", myDate);
System.out.println(myDate);
System.out.println(routines.TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss", d));

The code above outputs (to the System.out) your date as a UTC date in String form. Copy and paste this code into a tJava and you will see what I mean.

 

 

View solution in original post

1 Reply
Anonymous
Not applicable

This is all about timezones and it can get very confusing. But essentially, what you appear to be wanting to do is to use UTC as your timezone. There are a couple of methods that Talend provide for this, but first you need to know how your data is being stored. If it is being stored as a String, then it is relatively easy. You can use code similar to below.....

 

String myDate = "2019-03-17 06:15:00 +0400";

Date d = routines.TalendDate.parseDate("yyyy-MM-dd HH:mm:ss X", myDate);
System.out.println(myDate);
System.out.println(routines.TalendDate.formatDateInUTC("yyyy-MM-dd HH:mm:ss", d));

The code above outputs (to the System.out) your date as a UTC date in String form. Copy and paste this code into a tJava and you will see what I mean.