---
schema_version: "1"
id: c707343c8b215b504e8aded8b46f865c982430bbf0d95a51c5c2ccff77d4f08e
title: toDateTime(epoch)
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-datetime-epoch.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-timezone-datetime-epoch.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 14ed39017c11c7f16d376b558b3ba02b2b73eb050b367c629f8e1e622c039263
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# toDateTime(epoch)

Converts an epoch day to a `DateTime` type.

**note:** You can only use this function when the time zone feature is enabled. If the time zone feature is disabled, use the [toDate()](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-functions-todate.md) function.

```nolang
q = foreach q generate toDateTime(epoch) as "DateTime";
```

The _format_ argument isn’t valid for converting _epoch_ numerical values. It’s only valid for converting date string values.
