30 Date Formulas

30 Date Formulas

Master Tag
Tips & Tricks
Created
May 11, 2021 01:00 PM
Usage
Web Tags
Database
Formula
Alternatives
Cover

Donate

 
30 Formula Examples
Name
Date
Date-Range
1.
2.
3.
4.
5.
6.
7.
May 13, 2021

1. Date (without time) Is Tomorrow

formatDate(dateAdd(now(), 1, "days"), "L") == formatDate(prop("Date"), "L")

2. Date Is Today

formatDate(prop("Date"), "L") == formatDate(now(), "L")

3. Date Is Before Or On Today

now() > prop("Date")

4. Date Is Before Today

now() > prop("Date") and formatDate(prop("Date"), "L") != formatDate(now(), "L")

5. Date Is After Or On Today

formatDate(now(), "L") == formatDate(prop("Date"), "L") or now() < prop("Date")

6. Date Is After Today

now() < prop("Date")

7. Date Lands In This Week (M-Su)

formatDate(prop("Date"), "W") == formatDate(now(), "W")

8. Date Lands In This Week (Su-Sa)

formatDate(prop("Date"), "w") == formatDate(now(), "w")

9. Today Falls Within Date-Range

now() > start(prop("Date-Range")) and now() < end(prop("Date-Range")) or or(formatDate(now(), "L") == formatDate(start(prop("Date-Range")), "L"), formatDate(now(), "L") == formatDate(end(prop("Date-Range")), "L"))

10. From Date, Find Month And Return First Day Of Month

dateSubtract(prop("Date"), date(prop("Date")) - 1, "days")

11. From Date, Find Month And Return Last Day Of Month

dateSubtract(dateAdd(dateSubtract(prop("Date"), date(prop("Date")) - 1, "days"), 1, "months"), 1, "days")

12. Date Lands In Leap Year

if( year( prop("Date") ) % 4 == 0, if( year( prop("Date") ) % 100 == 0, if( year( prop("Date") ) % 400 == 0, true, false ), true ), false )

13. Week Number Of Month Date Lands In (M-Su)

ceil((date(prop("Date")) + day(dateSubtract(prop("Date"), date(prop("Date")) - 1, "days")) - 1) / 7)

14. Week Number Of Month Date Lands In (Su-Sa)

ceil((date(prop("Date")) + day(dateSubtract(prop("Date"), date(prop("Date")) - 1, "days"))) / 7)

15. Weekly Progress Indicator From Date (Su-Sa)

slice("◻️◻️◻️◻️◻️◻️◻️", 0, day(prop("Date")) * 2) + "🔲" + slice("◼️◼️◼️◼️◼️◼️◼️", 1, 14 - day(prop("Date")) * 2)

16. Weekly Progress Indicator From Date (M-Su)

if(day(prop("Date")) != 0, slice("◻️◻️◻️◻️◻️◻️◻️", 0, (day(prop("Date")) - 1) * 2) + "🔲" + slice("◼️◼️◼️◼️◼️◼️◼️", 1, 14 - (day(prop("Date")) - 1) * 2), "◻️◻️◻️◻️◻️◻️🔲")

17. Total Days In Date's Month

date(dateSubtract(dateAdd(dateSubtract(prop("Date"), date(prop("Date")) - 1, "days"), 1, "months"), 1, "days"))

18. Total Weeks In Date's Month

ceil((date(dateSubtract(dateAdd(dateSubtract(prop("Date"), date(prop("Date")) - 1, "days"), 1, "months"), 1, "days")) + day(dateSubtract(dateSubtract(dateAdd(dateSubtract(prop("Date"), date(prop("Date")) - 1, "days"), 1, "months"), 1, "days"), date(dateSubtract(dateAdd(dateSubtract(prop("Date"), date(prop("Date")) - 1, "days"), 1, "months"), 1, "days")) - 1, "days"))) / 7)

19. Find Exact Hours Between Date-Range

round(10 * dateBetween(end(prop("Date-Range")), start(prop("Date-Range")), "minutes") / 60) / 10

20. Find Hours And Minutes Between Date-Range

format(dateBetween(end(prop("Date-Range")), start(prop("Date-Range")), "hours")) + " hr " + format(dateBetween(end(prop("Date-Range")), start(prop("Date-Range")), "minutes") % 60) + " min"

21. Find Days, Hours, And Minutes Between Date-Range

format(dateBetween(end(prop("Date-Range")), start(prop("Date-Range")), "days")) + " dy " + format(dateBetween(end(prop("Date-Range")), start(prop("Date-Range")), "hours") % 24) + " hr " + format(dateBetween(end(prop("Date-Range")), start(prop("Date-Range")), "minutes") % 60) + " min"

22. Find What Quarter Date Lands In

formatDate(prop("Date"), "Q")

23. Find Season From Date (Northern Hemisphere)

if(toNumber(formatDate(prop("Date"), "DDD")) < 80, "🧤 Winter", if(toNumber(formatDate(prop("Date"), "DDD")) < 172, "🌷 Spring", if(toNumber(formatDate(prop("Date"), "DDD")) < 264, "🌞 Summer", if(toNumber(formatDate(prop("Date"), "DDD")) > 354 and toNumber(formatDate(prop("Date"), "DDD")) < 367, "🧤 Winter", "🍁 Fall"))))

24. Find Season From Date (Southern Hemisphere)

if(toNumber(formatDate(prop("Date"), "DDD")) < 80, "🌞 Summer", if(toNumber(formatDate(prop("Date"), "DDD")) < 172, "🍁 Fall", if(toNumber(formatDate(prop("Date"), "DDD")) < 264, "🧤 Winter", if(toNumber(formatDate(prop("Date"), "DDD")) > 354 and toNumber(formatDate(prop("Date"), "DDD")) < 367, "🌞 Summer", "🌷 Spring"))))

25. Find Time Of Day (ie. morning) From Date

if(hour(prop("Date")) == 0, "", if(hour(prop("Date")) < 12, "Morning", if(hour(prop("Date")) < 17, "Afternoon", if(hour(prop("Date")) < 25, "Evening", ""))))

26. Find Time Of Day (ie. morning) From Date-Range

if(hour(start(prop("Date-Range"))) == 0 and hour(end(prop("Date-Range"))) == 0, "", if(hour(start(prop("Date-Range"))) < 12, "Morning → ", if(hour(start(prop("Date-Range"))) < 17, "Afternoon → ", if(hour(start(prop("Date-Range"))) < 25, "Evening → ", ""))) + if(hour(end(prop("Date-Range"))) < 12, "Morning", if(hour(end(prop("Date-Range"))) < 17, "Afternoon", if(hour(end(prop("Date-Range"))) < 25, "Evening", ""))))

27. Extract Time From Date

formatDate(prop("Date"), "h:mm A")

28. Extract Time From Date-Range

if(dateBetween(end(prop("Date-Range")), start(prop("Date-Range")), "days") < 1, formatDate(start(prop("Date-Range")), "h:mm A") + " → " + formatDate(end(prop("Date-Range")), "h:mm A"), "")

29. Find Weekday From Date

formatDate(prop("Date"), "dddd")

30. Find Weekday From End Of Date-Range

formatDate(end(prop("Date-Range")), "dddd")