WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 2001:01:09:12:05:46
Last Updated: 2001:01:09:12:05:46