Category Archives: R

R functions for DateTimes in any time zone

I often find myself seeking a concise solution to check if I am running artificial intelligence stock trading algorithms at the right time for various exchanges around the world. Most of the users of our analyses want to see an analysis in their specific local time zone, so our scheduling servers and programs often have various checks, such as is it 3:59 PM in New York or 11:29 AM in Tokyo?

Here are two simple functions, to_tz() and now_tz(), with no package dependencies beyond Base R to address this specific area.

What time is it in New York?
now_tz(tz = “America/New_York”)
# “2016-12-29 19:02:14.84 EST”
Continue reading