Difference between 2 datetimes in Salesforce

Suyash N
Suyash N 6.8k Views Add a Comment

Calculate the difference between 2 datetimes in hours or minutes or days easily with the below tricks. You can calculate the difference in formula field or Visualforce page tag or in apex programming too. There are many other methods available in Datetime class of Salesforce to convert the Datetime values. To check out the list of the available methods Click Here.

To calculate the difference between the 2 dates Click Here.

For the difference between 2 DateTimes fields, check:

  • Formula Field

  • Visualforce Page

  • APEX

You can also use other methods available in the SF Datetime class for various DateTime conversions.

To get a specific parameter from your datetime variable, use .hour(), .minute(), .date(), .day(), .dateGMT(), etc.


Also Check:

For any queries or suggestions, comment below.

Cheers … Happy Coding … 🙂

Share This Article
Leave a comment
Notify of
Inline Feedbacks
View all comments