function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Thejasvi AThejasvi A 

How to extract Time from Date/Time field

Hi,
I have 2 Date/Time fields.
I want to throw a validation rule if 'Time' in one Date/time field is lesser than another Date/time field. 
I only want to check the time difference not the date. Could you please help me.
sravan velamasravan velama
Hi Thejasvi,

CASE(Mid(Text(TargetX_Eventsb__Start_Date_Time__c), 12,2), '06', '1', '07', '2', '08', '3', '09', '4', '10', '5', '11', '6', '12', '7', '13', '8', '14', '9', '15', '10', '16', '11', '17', '12', '18', '13', '19', '14', '20', '15', '21', '16', '22', '17', '23', '18', '24', '19', '25','20', '26', '21', '27', '22', '28', '23', '29', '24','0') & ':' & Mid(Text(TargetX_Eventsb__Start_Date_Time__c), 15,2)

(OR)

IF(
ISBLANK(Departure_Date_Time__c ),"0",
TEXT(MOD(VALUE(
Left(
right( trim(TEXT(Departure_Date_Time__c) ),9),2))+10,24))
&":"&mid(right( trim(TEXT(Departure_Date_Time__c) ),9),4,2)
)
Thejasvi AThejasvi A
Thank you Sravan.