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
praveenpropraveenpro 

Time Difference Calculation

Hi guys,

 

I have Two Picklists 1.Start Time 2.End Time. i want to find difference between the both times.

 

Ex: Start time: 8:00 AM  End Time :10:00 PM   i want to find Difference Between Start time and end time and difference time populate in another field

 

Give me Reply if any solution.

 

Praveen.

Subramani_SFDCSubramani_SFDC
praveenpropraveenpro

Thaks For Reply Mr Subra But my problem is Two times are string Vales. We need to convert into time and then need to subtract the time , we need to populate the time in hours.

Satyendra RawatSatyendra Rawat

Hi,

 

1. Create instance of date Sartdate and enddate and get the defference.

1.Write custom method for the deffrence time Logic is below :-

     both time convert into 24 hours and then

if(sartTime > endTime)

return (24-startTime)+ endTime;

else

 return endTime-endTime;

 

 

 

Get the deffrent time between two time.