---
schema_version: "1"
id: 805d8e1918610ed555f0854e247f3f5c5806047692118ce3e0276599ef2e1768
title: now()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/reference/bi-saql-functions-date-now.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-date-now.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b8de75ad3988751c12ff16b9c7b64b43c4c4b370de7ac94dcfe5e57d51a2f42d
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# now()

Returns the current datetime in UTC. This function is only valid in a `foreach` statement.

## Syntax

`now()`

## Usage

This function is commonly used with `daysBetween(​)`, `date_diff(​)`, and `date_to_string()`.

## Example

How long ago was each opportunity created, in weeks? Use `date_diff()`, _datepart_ = `week`, and `now()`.

```nolang
q = load "DTC_Opportunity";
q = foreach q generate date_diff("week", toDate(CreatedDate_sec_epoch), now() ) as 'Weeks to Close';
q = order q by 'Weeks to Close';
```

## Example

What is the date today? Use `now()` inside `date_to_string()`.

```nolang
q = load "DTC_Opportunity";

-- Notice how the ' character is escaped with the \ character in 'Today\'s
q = foreach q generate date_to_string(now(), "yyyy-MM-dd") as 'Today\'s Date';
```

**See Also**

- [date_diff()](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-date-diff.md)
- [now()](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/concept/bi-saql-functions-timezone-now.md)
