В Fri, 28 Jun 2024 18:52:26 +0200
Dennis Fisher <fis...@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

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to