fromTimestamp
Learn how to use the fromTimestamp function in Notion formulas.
The fromTimestamp() function converts a Unix timestamp into a date.
1
fromTimestamp(number)
The Unix timestamp is the number of seconds since January 1, 1970 at 00:00 UTC. It is also known as Unix time or Epoch time.
Note that Notion’s formula editor specifically looks for a Unix millisecond timestamp.
This is important to remember, because fromTimestamp(1656012840) returns January 20, 1970 4:00 AM in Notion (in UTC - it’ll look different based on your timezone).
Unix timestamps are normally expressed in seconds, so most epoch converters would express 1656012840 as June 23, 2022 7:34 PM.
In Notion, you’d need to write fromTimestamp(1656012840000) to get the same date.
You can use this tool to convert human-readable dates to timestamps, and vice-versa:
Epoch Converter
epochconverter
Learn more about Unix time:
What Is the Unix Epoch, and How Does Unix Time Work?
How-To Geek
Good to know: Notion will always show dates/times created using fromTimestamp() and now in your local time zone. You cannot specify another time zone (you can do this with actual date properties).

1
// Notion will express this date in your local time zone, so it
2
// may look different if you try this formula out.hin
3
fromTimestamp(1656012840000) // Output: June 23, 2022 7:34 PM (UTC)

The example database below uses timestamp and fromTimestamp() to take in a date and return a different, semi-randomized date.
A note about this example's "randomness"

fromTimestamp
College Info Geek on Notion

1
// Compressed
2
if(minute(prop("Edited")) % 2 == 0, fromTimestamp(timestamp(prop("Date")) + toNumber(slice(replaceAll(id(), "\\D", ""), (timestamp(prop("Edited")) + 956348) % 7 - 3, 13))), fromTimestamp(timestamp(prop("Date")) - toNumber(slice(replaceAll(id(), "\\D", ""), (timestamp(prop("Edited")) + 891327) % 7 - 3, 13))))
3
​
4
// Edited
5
if(
6
minute(
7
prop("Edited")
8
) % 2 == 0,
9
fromTimestamp(
10
timestamp(
11
prop("Date")
12
) +
13
toNumber(
14
slice(
15
replaceAll(
16
id(),
17
"\\D",
18
""
19
),
20
(timestamp(
21
prop("Edited")
22
) + 956348) % 7 - 3,
23
13
24
)
25
)
26
),
27
fromTimestamp(
28
timestamp(
29
prop("Date")
30
) -
31
toNumber(
32
slice(
33
replaceAll(
34
id(),
35
"\\D",
36
""
37
),
38
(timestamp(
39
prop("Edited")
40
) + 891327) % 7 - 3,
41
13
42
)
43
)
44
)
45
)
To return a seemingly random date, this formula takes the timestamp of the Date property's date and manipulates it.
First, an if statement determines if the minute of the input date is even or odd using the mod function.
If it is even, then the random date will be later than the input date. If odd, the random date will be earlier than the input date.
The number that is either added to or subtracted from the input date's timestamp is generated by taking the following steps:
  1. 1.
    Get the page id using the id function.
  2. 2.
    Remove all non-numeric characters with replaceAll (which searches for \\D, which is a special regular expression character class meaning "any non-numeric character").
  3. 3.
    ​Slice the resulting string in order to make it smaller. The end index is always 13, but the beginning index is variable. It is determined by (timestamp(prop("Edited")) + 956348) % 7 - 3.
  4. 4.
    ​Convert the sliced string to a number using toNumber.
This formula doesn't use now to determine its output, as the goal is for the date to change whenever the row is edited. Using now would cause the date to change every minute.

​
My name is Thomas Frank, and I'm a Notion-certified writer, YouTuber, and template creator. I've been using Notion since 2018 to organize my personal life and to run my business and YouTube channel. In addition to this formula reference, I've created a free Notion course for beginners and several productivity-focused Notion templates. If you'd like to connect, follow me on Twitter.
Last modified 20d ago
Copy link
On this page
Example Formula
Example Database
View and Duplicate Database
"Random Date" Property Formula