# Calculate the Time Between Two Dates

Use `date_diff()` and `daysBetween()` to calculate the time between two dates.

Use `now()` to get the current time. You can use these functions with `DateTime`, `DateOnly`, or `Date` types.

- **[date_diff(datepart, startdate, enddate)](/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-timezone-date-diff.md)**

  Returns an integer representing the interval that has elapsed between two dates.

- **[daysBetween(date1, date2)](/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-timezone-days-between.md)**

  Returns the number of days between two dates as an integer.

- **[now()](/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-timezone-now.md)**

  Returns current datetime in the specified time zone. This function is valid only in a `foreach` statement.
