Reformat TimeYmdHms for Simple Display
Keywords: TimeYmdHms timedate datetime
Question:
I want the date to display like:
10/29/99
Is there a Winbatch function to do that?
Answer:
Here's some simple code to do it:
now=TimeYmdHms()
year = ItemExtract(1,now,":") mod 100
month = ItemExtract(2,now,":")
day = ItemExtract(3,now,":")
;Some days and months may only have one digit.
;To make sure they have two digits:
If StrLen(year) == 1 then year ="0%year%"
If StrLen(month) == 1 then month="0%month%"
If StrLen(day) == 1 then day= "0%day%"
thedate = Strcat(month,"/",day,"/",year)
message("New date format", thedate)
Article ID: W14409
Filename: Reformat TimeDate for Display.txt