Convert Date Format In apex salesforce
-----------------------------------------------------------------------------------------------------------------------
Formula No. 1
-----------------------------------------------------------------------------------------------------------------------
String crDate;
dateTime d = logSheet.CreatedDate;
crDate = (d == null) ? '-' : d.day()+ '/' + d.month() + '/' + d.year();
System.debug(crDate);
-----------------------------------------------------------------------------------------------------------------------
Formula No. 2
-----------------------------------------------------------------------------------------------------------------------
String crDate;
date d = logSheet.CreatedDate;
crDate = (d == null) ? '-' : d.format('yyyy/MM/dd');
System.debug(crDate);
-----------------------------------------------------------------------------------------------------------------------
Comments
Post a Comment