Jump to content

Discordian date: Difference between revisions

m
→‎{{header|Tcl}}: comment adding
(→‎Tcl: Added implementation)
m (→‎{{header|Tcl}}: comment adding)
Line 56:
<lang tcl>package require Tcl 8.5
proc disdate {year month day} {
# Get the day of the year
set now [clock scan [format %02d-%02d-%04d $day $month $year] -format %d-%m-%Y]
scan [clock format $now -format %j] %d doy
 
if {!($year%4) && !(!($year%100) && ($year%400))} {
# Handle leap years
if {!($year%4) && !(!($year%100) &&|| !($year%400))} {
if {$doy == 60} {
return "St. Tib's Day, [expr {$year + 1166}] YOLD"
Line 65 ⟶ 68:
}
}
 
# Main conversion to discordian format now that special cases are handled
incr doy -1; # Allow div/mod to work right
set season [lindex {Chaos Discord Confusion Bureaucracy {The Aftermath}} \
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.