Across the 4th Dimension
by in CodeSOD on 2025-09-24We're going to start with the code, and then talk about it. You've seen it before, you know the chorus: bad date handling:
C_DATE($1)
C_STRING(7;$0)
C_STRING(3;$currentMonth)
C_STRING(2;$currentDay;$currentYear)
C_INTEGER($month)
$currentDay:=String(Day of($1))
$currentDay:=Change string("00";$currentDay;3-Length($currentDay))
$month:=Month of($1)
Case of
: ($month=1)
$currentMonth:="JAN"
: ($month=2)
$currentMonth:="FEB"
: ($month=3)
$currentMonth:="MAR"
: ($month=4)
$currentMonth:="APR"
: ($month=5)
$currentMonth:="MAY"
: ($month=6)
$currentMonth:="JUN"
: ($month=7)
$currentMonth:="JUL"
: ($month=8)
$currentMonth:="AUG"
: ($month=9)
$currentMonth:="SEP"
: ($month=10)
$currentMonth:="OCT"
: ($month=11)
$currentMonth:="NOV"
: ($month=12)
$currentMonth:="DEC"
End case
$currentYear:=Substring(String(Year of($1));3;2)
$0:=$currentDay+$currentMonth+$currentYear