---
schema_version: "1"
id: 069bcb8c645b98df86d18e35b18378832281f9da2003509bb2e42c9efbc1d0dd
title: Calculate the Time Between Two Dates
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/concept/bi-saql-functions-timezone-between.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-timezone-between.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: bace4604b4666f218f5406f52e44e3bcf2fa19c00120ee1b6152c7bcb4bbf74f
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# 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)](https://developer.salesforce.com/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)](https://developer.salesforce.com/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()](https://developer.salesforce.com/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.
