+ Start a Discussion
lapaullapaul 

extract time portion out of a date time object

Hi,

Has anyone have experience in extracting a time portion out of a date time object?

For example: 8/12/2009 2:20 PM

I just want to extract the time 2:20 PM from the date time object above. Please advice.

Your help is expreciated.

 

Paul

 

Best Answer chosen by Admin (Salesforce Developers) 
CRM JediCRM Jedi

Date.Format() will do the job.

 

Example:

 

system.debug(System.NOW().format('hh:mm a'));

 

 

 

Raymond

 

All Answers

CRM JediCRM Jedi

Date.Format() will do the job.

 

Example:

 

system.debug(System.NOW().format('hh:mm a'));

 

 

 

Raymond

 

This was selected as the best answer
lapaullapaul
Thanks so much, it worked.