You need to sign in to do that
Don't have an account?
sdfasd
how to convert the datetime field to salesforce datetime like 'yyyy-MM-dd\'T\'hh:mm:ss\'Z\''
how to convert the datetime field to salesforce datetime like 'yyyy-MM-dd\'T\'hh:mm:ss\'Z\''. this format i am write code like this.
DateFormat BSD;
DateFormat BSD = new SimpleDateFormat('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'');
BSD.setTimeZone(TimeZone.getTimeZone('GMT'));
i need DateTime yyyy-MM-dd\'T\'hh:mm:ss\'Z\'' this formate pls help me.........
If your datetime format is like this : '2012-08-19T19:30:07:00Z'. Then you can try below code.
string dt1= '2012-08-19T19:30:07:00Z';
string dt2 = dt1.replace('T',' ');
string dt3 = dt2.replace('Z,' ');
Then datetime newdt = datetime.valueof(dt3 );
Hope it helps!
Hi sdfasd,
If you want to convert a string 'yyyy-MM-dd\'T\'hh:mm:ss\'Z\'' to its equivalent date time then you would have to replace that to a valid DateTime String before converting it to datetime.
Run below query in system log to check if thats what you are looking for:
String formatStr = 'yyyyMMdd\'T\'HHmm\'00\'';
str = startDate.format(formatStr);
system.debug(str);