Hello,
What is 'Z'?
data _NULL_;
a="2012-07-07T20:44:30.293Z";
b=input(scan(a,1,'T'),YYMMDD10.); put b= date9.;
c=input(compress(scan(a,2,'T'),'Z'),time12.3); put c= time12.3;
d=b*24*60*60 + c; put d= datetime22.3;
run;
/* end of program */
Koen
I think "Z" means "Zulu Time", which is short for Coordinated Universal Time, or what is commonly known as GMT.
So simply discarding it will be OK.
That's an ISO date and there should be informats to handle it directly.
data demo;
a="2012-07-07T20:44:30.293Z";
b=input(a, B8601DZ.);
format b B8601DZ.;
run;
proc print;run;
@Pandu2 wrote:
Hi all,
I've a character value which is like "2012-07-07T20:44:30.293Z". I would like to change this format to datetime
Required : 2012-07-07T20:44:30.293Z
Thanks.
I would rather use the extended ISO 8601 formats/informats:
data demo;
a="2012-07-07T20:44:30.293Z";
b=input(a,e8601DZ.);
format b e8601DZ.;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.