---
schema_version: "1"
id: 4878695f13dc3b58471bee5624b50fdcdbbc80ebc11e2a1afd79919624fd53d6
title: date_to_epoch()
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-date2epoch.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-date2epoch.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9edd0d9936ed7e873d089351fcf603af2e1dab03323347c17beed5c049db1c73
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# date_to_epoch()

Converts a date to Unix epoch seconds.

## Syntax

`date_to_epoch(date)`

## Usage

This function must take a `toDate()` or `now(​)` function as its first argument.

## Example

```nolang
q = foreach q generate date_to_epoch(toDate(​”yyyy-mm-dd hh:mm:ss”)) as ds1;
```
