Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

time zone conversion SGT to UTC ****

HI all,

I Have a time field Its contains time in SGT zone I want to convert it into UTC format. So that I used the below code

Timestamp(field - time#(8,'hh.mm.ss'))

But it give the result wit date and the time format is like AM/ PM

1. I dont want the  date in my resultant set

2. I want the result in 24 hrs format not in AM/PM

Please do me the needful ASAP

thnx

10 Replies
Anonymous
Not applicable
Author

Hi,

The Timestamp() function takes a second parameter where you can define how you want to format the value.

Timestamp(TimestampValue, 'YYYY-MM-DD hh:mm:ss') for example gives you a value without the AM/PM part. If you hit F1 in QlikView and search for the timestamp function you can see the full syntax with examples.

Not applicable
Author

Hi thnx fr ur reply. 

But I tried those also.

If u have script fr this scenario plz share.

Even I seen UTC() but if I tried its nt reloading

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=Timestamp('3/12/2014 12:11:53 PM' - 0.33333, 'hh:mm:ss')

0.33333 is used to convert SGT to UTC

Regards,

Jagan.

Not applicable
Author

Hi jagan

This one gives me wrong result. Mins and seconds are not correct

tresesco
MVP
MVP

Try like this:

=Time(yourtimetime - time#(8,'h'), 'hh:mm:ss')

Not applicable
Author

Hi

I tried all these type of combinations but tht mins s not correct

U cab also test by hard coding some time manually

tresesco
MVP
MVP

With me it works fine!

jagan
Luminary Alumni
Luminary Alumni

Hi,

For me it is working correctly

=Timestamp('3/12/2014 12:11:53 PM' - 0.33333, 'hh:mm:ss')

I am getting 4:11:53

Regards,

Jagan.

Anonymous
Not applicable
Author

Hi,

Have you tried ConvertToLocalTime function? Accounding to the reference manual:

"ConvertToLocalTime(timestamp [, place [, ignore_dst=false]])

Converts a UTC or GMT timestamp to local time as a dual value. The place can be any of a number

of cities, places and time zones around the world"

For example if you want to converto from UTC to your local time you have to type:

=ConvertToLocalTime([timestamp UTC Time], 'GMT+08:00')

But, It also works backwards, if you want to calculate UTC time instead of adding 8 hours, subtract them:

=ConvertToLocalTime([timestamp Local Time], 'GMT-08:00')

Then just format the result using timestamp function. I have use this function before, and it worked for me.

Regards