---
title: "timestamps"
description: "Timestamps are a fundamental data type in databases and programming languages that represent a specific point in time, typically including both the date and…"
canonical: "https://motherduck.com/glossary/timestamps/"
related:
  - title: "DuckDB SQL | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/duckdb-sql-reference/"
  - title: "DuckLake Architecture Deep Dive"
    url: "https://motherduck.com/blog/ducklake-architecture-deep-dive/"
  - title: "Database Snapshots | MotherDuck Docs"
    url: "https://motherduck.com/docs/concepts/snapshots/"
gated_asset:
  title: "DuckLake on MotherDuck"
  url: "https://motherduck.com/product/ducklake/"
---

# timestamps

> Timestamps are a fundamental data type in databases and programming languages that represent a specific point in time, typically including both the date and…

Timestamps are a fundamental data type in databases and programming languages that represent a specific point in time, typically including both the date and time down to a precise level such as seconds or milliseconds. In DuckDB, timestamps can be stored and manipulated using the `TIMESTAMP` data type. They are particularly useful for tracking when events occur, logging changes, or performing time-based analytics.

To work with timestamps in DuckDB, you can use functions like `NOW()` to get the current timestamp, or create timestamps from strings using `CAST` or the `::` operator. For example:

<glossary-callout guide="duckdb-cheatsheet-full" />

```sql
-- Create a timestamp
SELECT CAST('2023-05-01 14:30:00' AS TIMESTAMP);

-- Or using the shorthand syntax
SELECT '2023-05-01 14:30:00'::TIMESTAMP;

-- Get the current timestamp
SELECT NOW();
```

DuckDB also provides various functions for extracting parts of a timestamp or performing calculations:

```sql
-- Extract the year from a timestamp
SELECT EXTRACT(YEAR FROM '2023-05-01 14:30:00'::TIMESTAMP);

-- Add one day to a timestamp
SELECT '2023-05-01 14:30:00'::TIMESTAMP + INTERVAL '1 day';
```

Understanding and effectively using timestamps is crucial for data analysts and engineers working with time-series data, event logs, or any application where precise timing information is important.
