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;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.