? Fri, 28 Jun 2024 18:52:26 +0200
Dennis Fisher <fisher at plessthan.com> ?????:
> When I issue the command:
> Sys.Date()
> I would like to be able to obtain the value for Pacific time (which
> differ for the first 9 hours of the day)
By the time the value of Sys.Date() is created, it's too late to
discern between Europe and Pacific time. The Date class is intended to
store the integer number of days since 1970-01-01:
unclass(Sys.Date())
# [1] 19902
Only by preserving the time we can get a timezone-dependent date:
format(Sys.time(), '%Y-%m-%d') # uses the current time zone
# [1] "2024-06-28"
format(Sys.time(), '%Y-%m-%d', tz = 'Asia/Vladivostok')
# [1] "2024-06-29"
--
Best regards,
Ivan