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-boun...@r-project.org 
<mailto:r-help-boun...@r-project.org>> on behalf of Dennis Fisher 
<fis...@plessthan.com <mailto:fis...@plessthan.com>>
Date: Thursday, August 17, 2023 at 4:31 PM
To: <r-help@r-project.org <mailto:r-help@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/&gt;>

______________________________________________
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