Date formate using in Salesforce:
DateTime dt = Datetime.now();
String strTimeInAMorPM = dt.format('MMMMM dd, yyyy hh:mm:ss a');
System.debug('time in am and pm ==> '+strTimeInAMorPM);
String strTimeInWeek = dt.format('MMMMM dd, yyyy EEEE');
System.debug('strTimeInWeek ==> '+strTimeInWeek);
String strTimezone = dt.format('MMMMM dd, yyyy z');
System.debug('strTimezone ==> '+strTimezone);
Output:
https://www.salesforcecodecrack.com/2020/04/format-dates-and-time-using-apex-in.html
No comments:
Post a Comment