Date formatting

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
rguez_18
Newbie
Posts: 4
Joined: Fri Jun 06, 2014 4:26 am

Date formatting

Post by rguez_18 » Mon Jul 28, 2014 3:56 pm

Hi,
Sorry for the newbie question, but is there a command to format date within MS? I want to 0 pad the date and time I'm getting whenever I call on the getdate function e.x 07272014 01:05:01 AM

Thanks!

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Date formatting

Post by JRL » Mon Jul 28, 2014 6:44 pm

GetDate and GetTime won't give you 0 padded date/time. Use VBScript instead.

Code: Select all

VBEval>Year(now) & "-" & Right("0" & Month(now),2) & "-" & Right("0" & Day(now),2),PaddedDashDate
VBEval>Year(now) & "/" & Right("0" & Month(now),2) & "/" & Right("0" & Day(now),2),PaddedSlashDate
VBEval>Right("0" & Hour(now),2) & ":" & Right("0" & Minute(now),2) & ":" & Right("0" & Second(now),2),PaddedColonTime

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts