Is it possible for Snap! to record real Date and Time?

Hello there reader,

Today my question is quite simple, I hope-

Is there a way to code a project to detect the date and time?

Such as, the code would follow GMT in timezone, and would have two variables;
The Date (DD/MM/YYYY)
The Time (Hour:Minute)

I'm working on a project where I'd like to have a rotation of a certain kind of mechanic that is based on time, and if I were to figure out how to code this, it'd help tremendously

You can use the (current [date]) block. It has options for year, month, date (day in month), day of week, hour, minute, second, and time in milliseconds.
untitled script pic (25)

All CURRENT varieties are based on local date & time (assuming your device knows what they are) …
… except for CURRENT (time in milliseconds), which is UTC-based (UTC is only fractionally different from GMT), with 0 = Jan. 1, 1970, 00:00:00. Again, assuming your device’s date & time settings are, literally, up-to-date,

Yeah, I guess it is. I tested it, and it's obly the minute, hour and second that changes when I change my time zone. Milliseconds doesn't, although it is still dependent on the user date and time settings.

I made a block that should do what you want
I'm in UK where we are currently 1 hour ahead of UTC

untitled script pic - 2023-05-27T071713.985
untitled script pic - 2023-05-27T071916.585

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.