+ Start a Discussion
Book_GuyBook_Guy 

Extract Time from LastModifiedDate

Hi All,

 

How would I create a formula that extracts the time from a LastModifiedDate field.  For example:

 

Last Modified By = David Levins, 1/31/2012 9:58 AM

Want Time Stamp formula field to equal "9:58 AM"

 

Thank you.

 

--David

SFRichSFRich

Try using the Apex  format method:

 

String myDate = myDT.format('h:mm a');

 

(taken from page 274 in the Apex Code Developer's Guide - Winter 12)

Book_GuyBook_Guy

Is there a way to use the functionality in a formula field without using Apex?

SFRichSFRich

This will give you the time in the Zulu (GMT) timezone:

 

MID( TEXT( LastModifiedDate) , 12,8)

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below formula

 

SUBSTITUTE(TEXT(  LastModifiedDate ), TEXT( DATEVALUE( LastModifiedDate)) , '')

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.