24 сентября 2024 г. 17:10:13 GMT+03:00, Luca Brinkmann via R-help 
<r-help@r-project.org> пишет:
> My current
> understanding is, that a Date object does only save the days from the
> origin and no more information about timezones or other information
> (please correct me if I am wrong).

You are correct.


> the date object is displayed in my RStudio environment as "2024-11-11
> UTC".

This looks like a result of as.POSIXlt(<Date object>).

> In contrast, getting the timezone information with base::format will
> yield the timezone information
> > base::format(d, format="%Z")
> [1] "UTC"

That's an implementation detail: the format() method for Date objects conjures 
a temporary POSIXlt object and formats the result, and POSIXlt objects can 
contain time zone information.

> Is there any way to add timezone information to an Date
> object (other than UTC) and keeping it a Date object?

Not with a plain 'Date'. What should a date in a timezone mean? Start of day? 
End of day? The whole 24-hour interval (except when it lasts 23 or 25 hours due 
to DST)?

Perhaps you could store one (or two for an interval) POSIXt object(s) if you 
need timezone information for your dates.

-- 
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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to