Program Functions

What Does The Timestamp Function Do In Notion?

timestamp-formula-notion.png

🛠 Decode Timestamp

Timestamp is a formula function in Notion that allows the user to create a unix timestamp from any given date, including now. What is the unix timestamp? It is a method of time tracking that takes the total number of seconds from January 1st, 1970 at UTC.

Benefit Of Using The Unix Timestamp

This timestamp does not change due to location on the globe. Computers use the unix timestamp to utilize time without timezone complications. As for Notion, the best use for the timestamp function is for dates that aren't currently being used in the database.

Decoding The Timestamp Functions

  1. timestamp(date property): 1620157140000 (13 digit number)

  2. fromTimestamp(1620157140000): May 4, 2021 3:48 PM

Use-Case For Timestamp Function

For example, if I want to find how many days are between now and December 5th, 2018, I don't have to create a date property with this date in order to make the formula work. Instead, I can determine what timestamp aligns with December 5th, 2018 and work from there.

  • Step 1: Find timestamp of December 5th, 2018 with formula called "Temporary Date"

    • timestamp(prop("Temporary Date"))

      • = 1543986000000

  • Step 2: Find days between December 5th, 2018 and today with this formula:

    • dateBetween(now(), fromTimestamp(1543986000000), "days")

      • = 881

Limitation Of Timestamp

Inside Notion, the timestamp function does not read seconds in a date with time. It stops at minutes as a result of how time is read in the program. This is why using timestamps to create unique IDs may be tricky. The user must wait one minute between database entries to generate true unique numbers.

 

Further Reading