Beli Löw
Data migration can be overwhelming, especially when you have many migrations to handle. That's why our formulas master and I have created a huge library of formulas to make the process easier. I wanted to share one of these formulas with you (cause sharing is caring) which is awesome for converting between time and decimal formats.
- What is it about
- 1. From Hours (text property) and minutes (hh:mm) to Decimal
- 2. From Decimal (text property) to Hours and Minutes (hh:mm)
- 3. From Decimal (number property) to Hours and Minutes (hh:mm)
What is it about
In this article weâre going to share with you our three different formulas, they are quite simple to implement (you will only need to copy and paste, kinda)
1. From Hours (text property) and minutes (hh:mm) to Decimal
This formula converts time from hours and minutes format in a Text Property (like "2:30") into decimal hours (like "2.5"). For example, 1 hour and 30 minutes (1:30) would become 1.50 in decimal format.
This is the formula for you to copy, but there are some other steps to make it fit you database.
lets(
minuten,
prop("Time (hh:mm)").replaceAll("\d*:"),
minutenDezimal,
minuten.toNumber()/60,
stunden,
prop("Time (hh:mm)").replaceAll(":\d*"),
stundenDezimal,
stunden.toNumber(),
round((stundenDezimal+minutenDezimal)*100)/100
)
- Create your database and add a
text property
- Add a
formula property
- Go to edit property and click on
edit formula
- Copy the formula you have above.
- Edit the formula by adding the property you would like to convert, for example if the name of your property is
Time (hours:minutes)
in the formula youâll change("Time (hh:mm)") to (âTime (hours:minutes)â)
2. From Decimal (text property) to Hours and Minutes (hh:mm)
This formula converts decimal time from a text property (like "2.5") back into hours and minutes format (like "2:30"). For example, if you have 1.75 hours in decimal format, it will convert it to 1:45 in time format.
lets(
minuten,
prop("Time (h.m)").replaceAll("\d*\.","0."),
minutenDezimal,
round(minuten.toNumber()*0.6*100),
minuteZweistellig,
ifs(minutenDezimal<10,"0"+minutenDezimal,minutenDezimal),
stunden,
prop("Time (h.m)").replaceAll("\.\d*"),
stundenDezimal,
stunden.toNumber(),
stundenDezimal+":"+minuteZweistellig
)
The steps are the same as above, but we made a lil tutorial for you to follow along đ
3. From Decimal (number property) to Hours and Minutes (hh:mm)
This formula converts decimal numbers (like 2.5) from a number property into time format (hours:minutes). For example, if you have 2.5 in your number property, the formula will convert it to "2:30". This is particularly useful when you need to display decimal hours in a more readable time format.
This is our final gift to help you level up your Notion databases and make your data migration simpler.
lets(
minuten,
đą Decimal (number)-đą Decimal (number).floor(),
minutenDezimal,
round(minuten*0.6*100),
minuteZweistellig,
ifs(minutenDezimal<10,"0"+minutenDezimal,minutenDezimal),
stunden,
đą Decimal (number).floor(),
stundenDezimal,
stunden.toNumber(),
stunden+":"+minuteZweistellig
)
By following this gifs you will notice itÂżs pretty simple, just remember to change the property you want to apply the formula to.
FAQ
Beli Löw
Beli is an IT project manager, tool enthusiast, entrepreneur and has organized his whole life with Notion. His news sources are release notes from tools. There is (almost) no feature or shortcut that he does not know.
Join us Today: and become a Notion know-all
Wouldnât you like to know more?
Keep ReadingâŠ