function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sun tarsun tar 

How to convert to 2014-12-23T06:00:00.000Z format?

Hi all,

How to convert the date time format (2014-12-23 13:19:13) to the following format 2014-12-23T06:00:00.000Z ?

Anoop yadavAnoop yadav
Try the below Code.
DateTime dt =;

sun tarsun tar
that again returns a string right and if u parse it then it would again be in the format
Anoop yadavAnoop yadav
yes this is in String Format.
But using parse method you can not convert to DateTime again.
Kislay KumarKislay Kumar
For those who are here searching correct GMT format, try below:
Datetime d =;  //Returns GMT time, also SF stores all datetime in objects in GMT format only.
String dt = String.valueOf(d.dateGmt())+'T'+String.valueOf(d.timeGmt());