You need to sign in to do that
Don't have an account?
bharath11r
Parse zulu time string to DateTime error
I am getting a string something like from soap response 2012-02-21T11:27:54.134Z
and when i try to parse it using Datetime.Parse('2012-02-21T11:27:54.134Z') it's saying invalid time.
Could anyone please help me with this.
Thanks!
That will never work in my case because its an expiration field and I cannot cast it is as Date.
Above code works because its date field but try chaning it to DateTime and you will see my errors.
Alrite after pulling my hair for long time I got the answer.
string s = '2012-02-21T11:27:54.14Z';
System.Debug('DateValue is '+Datetime.valueOf(s.replace('T',' ')));
All Answers
Hi,
Try the below code snippet as reference:
date dt=date.valueof('2012-02-21T11:27:54.14Z');
system.debug('@@'+dt);
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
That will never work in my case because its an expiration field and I cannot cast it is as Date.
Above code works because its date field but try chaning it to DateTime and you will see my errors.
Alrite after pulling my hair for long time I got the answer.
string s = '2012-02-21T11:27:54.14Z';
System.Debug('DateValue is '+Datetime.valueOf(s.replace('T',' ')));