Help with converting datetime from standard to local time

Reply
Frequent Contributor
Posts: 91

Help with converting datetime from standard to local time

SAS folks-

 

I have just learned that I have a conflict in my data. One source gives datetime values in local (EST/EDT, depending), and the other gives datetime values, always in standard time (EST).  

 

I need to do the conversion on the EST dataset to make it local, and the readings are hourly or more frequent.  I have the option of either a data step or SQL.

 

I see lots of code and discussion on how to find the dates for daylight savings, but I have not yet be able to find a solution for the actual conversion posted. I’m sure that lots of you out there have already done this – would you please share?

 

I'm not concerned which value set for the overlap hour in 'fall back' remains in the dataset, but I don't want duplicates.  

 

Thanks so much for your help!

 

WendyT

Trusted Advisor
Posts: 1,795

Re: Help with converting datetime from standard to local time

[ Edited ]

If you know which dates need the conversion because daylight savings time applies, then you simply have to subtract 1 hour to wind up with standard time.

 

converted_datetime=intnx('dthour',original_datetime,-1);
Ask a Question
Discussion stats
  • 1 reply
  • 203 views
  • 0 likes
  • 2 in conversation