# timestamp

Learn how to use the timestamp function in Notion formulas.
The `timestamp()` function converts a date argument into its corresponding Unix timestamp (also known as Unix Time or Epoch Time), which is a number.
1
timestamp(date)
The Unix timestamp is the number of seconds since January 1, 1970 at 00:00 UTC.
Notion’s `timestamp()` function specifically outputs a millisecond timestamp.
You can use this site to convert human-readable dates to Unix timestamps, or vice-versa:
Good to know: Since Notion returns a millisecond timestamp, pasting the timestamp for very early dates (e.g. January 8, 1970) can cause conversion tools like the website above to return an incorrect date.
To account for this, remove the final three zeroes (000) from Notion’s timestamp before pasting into a conversion tool.

## Example Formula

1
timestamp(now()) // Output: 1656012120000 (will change with the value of now()

## Example Database

The example database below uses the `timestamp()` function to determine which of two dates is the later one.

### "Later Date" Property Formula

1
// Compressed
2
if(timestamp(prop("Date 1")) == timestamp(prop("Date 2")),"Date 1 and Date 2 are the same.",if(timestamp(prop("Date 1")) > timestamp(prop("Date 2")),"Date 1 is later than Date 2.","Date 2 is later than Date 1."))
3
4
// Expanded
5
if(
6
timestamp(
7
prop("Date 1")
8
) == timestamp(
9
prop("Date 2")
10
),
11
"Date 1 and Date 2 are the same.",
12
if(
13
timestamp(
14
prop("Date 1")
15
) > timestamp(
16
prop("Date 2")
17
),
18
"Date 1 is later than Date 2.",
19
"Date 2 is later than Date 1."
20
)
21
)
This formula uses a nested if-statement to first check if the timestamp values of the two dates are equal. If they are, the formula returns, "Date 1 and Date 2 are the same."
If not, the next block checks to see if Date 1's timestamp is larger than Date 2's timestamp.
Depending on the result of this comparison, the formula will return, "Date 1 is later than Date 2," or "Date 2 is later than Date 1."