Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date formating

Status
Not open for further replies.

flushie86

IS-IT--Management
Aug 11, 2004
17
0
0
US
I currently have a script that takes the date of the system and adds 1 day to it, but the end result is not what I need. My date is formatted as mm/dd/yyyy but I need it to append a 0 to the first value of the month if its Jan-Sept. Is there a format function that will allow for this formatting. this will be a login script so I don't want it to be a long drawn out procedure. Thanks.

strTest = DateAdd("d", 1, DATE)
 
Code:
strTest = DateAdd("d", 1, DATE)

WScript.Echo Left("0" & Month(strTest),2) & "/" & Left("0" & Day(strTest),2) & "/" & Year(strTest)


I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
dtTomorrow = 1 + Date
strTomorrow = Right("0" & Month(dtTomorrow),2) & "/" & Right("0" & Day(dtTomorrow),2) & "/" & Year(dtTomorrow)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
OOPs, thanks PHV, I used Left instead of Right. Guess I'm not in my Right Mind this morning.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top