Need help with the date script

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Need help with the date script

Post by timle » Thu Dec 06, 2007 4:33 am

Day>today
add>today,1
Let>tomorrow=today+1
message>tomorrow is the %tomorrow%

When I run this script, it convert the date to one digit. How could I keep the date to display 2 digits "07"

thank you

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Dec 06, 2007 8:48 am

The mathematical operation is converting the value to a number. If you want prefixed zeros you need to format it as a string again. This will do what you want:

Code: Select all

VBSTART
VBEND

Day>today
add>today,1
Let>tomorrow=today+1

VBEval>Right("0" & "%tomorrow%",2),tomorrow

message>tomorrow is the %tomorrow%
See the VBEval line which uses the Right function. We add a 0 to the left of the value and then take only the last two digits. So if tomorrow was 10 or more, we'd still end up with only two digits without the prefixed zero.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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