How to get New York time (EST/EDT) when considering daylight saving time?

I am trying to get New York time (which is different than my local time) by following code in Lua:

local utc\_t = os.date("!\*t", os.time()) local tzoffset = -1 \* 5 \* 60 \* 60 -- EST is -05:00 from UTC local est\_t = os.date("\*t", os.time(utc\_t) + tzoffset)

However, for New York, there is daylight saving time (& the dates to enter/exit daylight saving time are different each year).

Is there any way I can get the correct New York time at any given time in any local timezone?

 

If you Google: Lua Time Zone 

you’ll get a bunch of links that might be of help…

I already Googled before I asked.

I couldn’t find the answer for my question. Either there is some trick I am missing or I have to calculate daylight saving time by myself.

If you Google: Lua Time Zone 

you’ll get a bunch of links that might be of help…

I already Googled before I asked.

I couldn’t find the answer for my question. Either there is some trick I am missing or I have to calculate daylight saving time by myself.