\ Convert Date to Unix Timestamp : date-to-unix ( year month day hour minute second -- unix-timestamp ) 1970 swap - \ calculate year difference 365 * 86400 * \ convert years to seconds (simplified without leap years) swap 30 * 86400 * + \ convert months to seconds (simplified without precise month lengths) swap 86400 * + \ convert days to seconds swap 3600 * + \ convert hours to seconds swap 60 * + \ convert minutes to seconds + \ add seconds ; \ Example usage 2022 5 15 8 30 45 date-to-unix . \ Output Unix timestamp
date-to-unix
60 /mod
12345 60 /mod
86400 *
5 86400 *
365 * 86400 *
1 365 * 86400 *
swap
5 10 swap
dup
5 dup
mod
125 60 mod
+
5 3 +
-
10 5 -