[R] Timezone question

Marc Schwartz m@rc_@chw@rtz @end|ng |rom me@com
Fri Aug 18 00:05:46 CEST 2023


Hi Dennis,

I believe that it may be as simple as:

> format(Sys.time(), "%z")
[1] "-0400"

Where "%z" returns the offset from UTC as a character vector, and where I am in:

> Sys.timezone()
[1] "America/New_York"

There may be some subtleties, and I would suggest reading the relevant help files for ?strptime and the above two functions.

Regards,

Marc Schwartz


-----Original Message-----
From: R-help <r-help-bounces using r-project.org <mailto:r-help-bounces using r-project.org>> on behalf of Dennis Fisher <fisher using plessthan.com <mailto:fisher using plessthan.com>>
Date: Thursday, August 17, 2023 at 4:31 PM
To: <r-help using r-project.org <mailto:r-help using r-project.org>>
Subject: [R] Timezone question


R 4.3.1
OS X


Colleagues


Is there a simple way to determine the timezone offset for my present location. For example, during standard time in the US, the offset from GMT is 8 hours in California.


Dennis


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone / Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com <http://www.plessthan.com/> <http://www.plessthan.com/>>



More information about the R-help mailing list