Using now() in different time zones (or with daylight saving time)
Show older comments
If two people in two different time zones simultaneously used the now() function, would they get different answers? Also, does the now() result depend on whether daylight saving time is in use?
I understand now() returns the number of days since 0 Jan 0000, but does that mean "0 Jan 0000 UTC", or "0 Jan 0000 in the local time zone"?
Many thanks,
Neil
2 Comments
Stephen23
on 6 Dec 2019
in the local time zone (i.e. the one the computer is set to).
Neil Rogers
on 6 Dec 2019
Accepted Answer
More Answers (1)
Jeremy
on 6 Dec 2019
now
Limitations
- MATLAB Online returns the current date and time in Coordinated Universal Time (UTC) rather than local time.
1 Comment
Jeremy
on 6 Dec 2019
Additionally, you can use the syntax
[c tf] = clock
Where tf will be a logical that is 1 (true) if the current local date and time occur during Daylight Saving Time in your current time zone, and 0 (false) otherwise.
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!