This course is currently a work in progress. Please join the waitlist to receive regular updates.

Days between dates in apex

In Apex, you can use daysBetween() function to find the number of days between two dates. The daysBetween function is applied on the start date and the second date is passed as a parameter to the function.

Loading...

In the above example:

  • The variable startDate is assigned to today's date.
  • The variable endDate is assigned to 30th day from today.
  • The daysBetween function is used to find the number of days betweenstart date and end date.

Try It Yourself

Loading...