Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
evansabres
Specialist
Specialist

Change a time stamp

Hello -

I have a database for which each record has a time stamp. The timestamp reads:

2015-02-01 02:47 +0000

Signifying February 1, 2015 at 2:47 am (time is in military time)

My problem is that my app is being developed for an eastern time zone company and the records that are being time stamped are happening on an eastern time zone standard. So, this particular record actually occurred on January 31, 2015 at 10:47 PM. (There is a four hour time differential between when the record is being time stamped and when it is actually happening.

Is there a way within the scripting to change this so that the time zone can have four hours subtracted. Additionally, in the instance where the four hours results in a change of day, can this be accounted for in the scripting as well.

Thank you.

3 Replies
maxgro
MVP
MVP

maybe (replace '2015-02-01 02:47 +0000' with your field)

=timestamp(Timestamp#(left('2015-02-01 02:47 +0000',16), 'YYYY-MM-DD hh:mm')

- 4/24, 'DD/MM/YYYY hh:mm TT')

- left to get the bold of your string

- timestamp# to interpret

- subtract 4/24 (1 is one day, 4/24 for 4 hours)

- timestamp to format

marcus_sommer

Try it with YourTimestamp - (4/24) and I think there also convert-function available: converttolocaltime().

- Marcus

jonasheisterkam
Partner - Creator III
Partner - Creator III

timestamp(Field + MakeTime(4)) as Field

The most SQL Databases can convert it during the select. If the timezone is defined in database you have no problem to convert it between timezones with/without summer/wintertime.