record.Start_Time__c.time() is giving me
11:30:00.000Z but I just want
11:30am or pm or army time might be ok too.
currStartDate.Date() is giving me
2015-07-08 00:00:00 but I just want
What do I need to do?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
Take a look at Java SimpleDateFormat.
system.debug(Datetime.now().format('hh:mmaa')); // 08:24AM system.debug(Datetime.now().format('hh:mm:ss aa')); // 08:24:07 AM system.debug(Datetime.now().format('yyyy-MM-dd')); // 2016-05-31
Note that these are methods on
Datetime, so you should not call
time() on your
Datetime value before doing the formatting, as doing so will change the type to
Time respectively, and neither of these types have a
format method defined`.