Page 1 of 1

UTC [Universal Time]

Posted: Mon Jan 14, 2019 5:30 pm
by hrcap
Hi All

Standard first post disclaimer... I am new to Livecode currently learning the ropes to allow me to move away from Filemaker. Very exciting times as it seems there are far more possibilities ahead.

I have a very basic question in that I would like to know how to put the UTC into a variable. This UTC will be used as a sync timestamp. Im guessing something similar to;

Put the UTC into tTimestampUTC


Many Thanks in Advance

Re: UTC [Universal Time]

Posted: Mon Jan 14, 2019 5:38 pm
by Klaus
Hello hrcap,

welcome to the forum!

LC does not support UTC directly, but you can always get the time (or seconds since 1/1/1970), which if then fetched from the underlying machine. Maybe something like this is what you are looking for:

Code: Select all

...
put the seconds into tTimestampUTC
## or even:
## put the millisecs into tTimestampUTC
...
I can recommend these stacks to learn more about the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html

Best

Klaus

Re: UTC [Universal Time]

Posted: Mon Jan 14, 2019 5:57 pm
by bogs
Klaus wrote:
Mon Jan 14, 2019 5:38 pm
LC does not support UTC directly, but you can always get the time (or seconds since 1/1/1970), which if then fetched from the underlying machine.
...or, you might use the internet date ~
The internet date form returns the following parts, separated by spaces:
* the day of the week followed by a comma
* the day of the month
* the three-letter abbreviation for the month name
* the four-digit year
* the time in 24-hour format, including seconds, delimited by colons
* the four-digit time zone relative to UTC (Greenwich) time

Re: UTC [Universal Time]

Posted: Wed Jan 16, 2019 12:17 am
by hrcap
Thank you very much for the swift responses, I've gone for the 'put the seconds' option and it appears to be working nicely.

Many Thanks