Convert seconds to dateItems

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Convert seconds to dateItems

Post by Nakia » Mon Apr 15, 2013 4:19 am

Hi All,

I am using the "convert" function to convert a GPS time (UTC/GMT) into local time.
I am using the following code but I have found that it "seems" to apply the GMT offset of the host machine when it does the conversion and I need to be able to DISABLE this and just get it convert into GMT zero offset.

As an exmaple, tSeconds = 1365975270

Code: Select all

convert tSeconds from seconds to dateItems
The result I get is = "2013,4,15,7,34,30,2" according to an online converter this is the result when you convert to my local offset (GMT+10)

anyone got any ideas?
Attachments
Convert.JPG

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Convert seconds to dateItems

Post by shaosean » Mon Apr 15, 2013 9:43 am

perhaps try using the internet date function so you can get the difference between the timezone and GMT and then do some quick math..

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Contact:

Re: Convert seconds to dateItems

Post by splash21 » Mon Apr 15, 2013 9:59 am

Agree with Shaosean : put word 6 of the internet date into tOffset
That's worked for me :D
LiveCode Development & Training : http://splash21.com

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Convert seconds to dateItems

Post by Nakia » Tue Apr 16, 2013 5:26 am

Thanks guys, looked a bit painful at first but it all worked out okay...

Post Reply