Conversion of ISO8601 date format to Hour format

Reply
Occasional Contributor
Posts: 8

Conversion of ISO8601 date format to Hour format

[ Edited ]

Hi All, 

 

I want to Convert the date/time from ISO8601 format to hour Format Please help on this. I have data like

 

name      Date1                           Date2

XYZ       2016-10-03T13:05         2016-09-26T12:35
ABC       2016-07-15T12:00         2016-10-18T11:30

BAC       2016-10-26T12:00         2016-08-10T10:45

CAB       2017-06-02                   2016-09-26T11:30

BDG      2016-06-23T14:00         2016-10-18T09:28
           
I require the output in two variables Hour1  and Hour2          

 

Thanks in advance

 

Regards

Daya 

             
            
            

 

SAS Super FREQ
Posts: 683

Re: Conversion of ISO8601 date format to Hour format

[ Edited ]

Have a look at the E8601DT informat, it will read char values as you show them below and convert it to a SAS Datetime value. You can use then the TIMEPART() function to only the time information.

Super User
Posts: 6,940

Re: Conversion of ISO8601 date format to Hour format

Do a google search for "sas iso 8601 informat", and you'll have all the information you need. And much more.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 2 replies
  • 135 views
  • 1 like
  • 3 in conversation