UTC [Universal Time]

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

UTC [Universal Time]

Post by hrcap » Mon Jan 14, 2019 5:30 pm

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

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: UTC [Universal Time]

Post by Klaus » Mon Jan 14, 2019 5:38 pm

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

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: UTC [Universal Time]

Post by bogs » Mon Jan 14, 2019 5:57 pm

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
Image

hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Re: UTC [Universal Time]

Post by hrcap » Wed Jan 16, 2019 12:17 am

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

Post Reply