BookmarkSubscribeRSS Feed
mlogan
Lapis Lazuli | Level 10

Hi there,

I have the date time format as '1/11/2017 8:00:41 AM +00:00' and it is in character format. I don't there this '+00:00' came from, but in my all data they all end with '+00:00', so I really don't care.

can someone help me convert it to Datetime format like '1/11/2017 8:00:41 AM' please? 

 

DATA Have;
Date_Time='1/11/2017 8:00:41 AM +00:00';
RUN;

 

Thanks.

 

 

 

 

3 REPLIES 3
novinosrin
Tourmaline | Level 20

DATA Have;
Date_Time='1/11/2017 8:00:41 AM +00:00';
RUN;

data want;
 set have;
 want_date=input(date_time,mdyampm23.);
 format want_date  DATEAMPM. ;
run;
dennis_oz
Quartz | Level 8

@novinosrin @mlogan 

 

Hi I have a similar question . How to convert 28-APR-20 02.56.42.897749 PM   ( length is 28 char) to DATETIME ? Please can you help

novinosrin
Tourmaline | Level 20

Hi @dennis_oz  Would the below suffice?

data w;
 have='28-APR-20 02.56.42.897749 PM';
 want=input(have, datetime30.);
 format want datetime30.;
run;