VBSTART
VBEND
//This to set the new name with ho code
Day>pubday
//Add>pubday,1
Let>pubday=pubday+1
VBEval>Right("0"&"%pubday%",2),pubday
Month>pubmonth
let>EditionCode=ho
let>EditionDate=%pubmonth%%pubday%
let>Product=tvgrid
let>Newname=%EditionCode%%pubmonth%_%pubday%___%EditionCode%%pubmonth%%pubday%%Product%.pdf
On thursday, the file supposed to rename the pubmonth and day to 02_01, It renamed to 01_32
Would someone help me figure out please so it will know the right calendar date
Thank you
Date calculated wrong
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Let's take a look at that code. We'll assume the date is 31st of Jan. Take a look at this bit of code here:
Day>pubday
So pubday = 31
//Add>pubday,1
Let>pubday=pubday+1
So pubday now equals 32. All you've done is added one to 31.
You've made pubday = 32.
You have NOT added one day to a DATE. You have added the number 1 to the number 31.
This would be better:
VBEval>Day(Now+1),pubday
This adds one day to the current date and returns the day portion.
So your script would be:
VBSTART
VBEND
//This to set the new name with ho code
VBEval>Day(Now+1),pubday
VBEval>Right("0"&"%pubday%",2),pubday
Month>pubmonth
let>EditionCode=ho
let>EditionDate=%pubmonth%%pubday%
let>Product=tvgrid
let>Newname=%EditionCode%%pubmonth%_%pubday%___%EditionCode%%pubmonth%%pubday%%Product%.pdf
Day>pubday
So pubday = 31
//Add>pubday,1
Let>pubday=pubday+1
So pubday now equals 32. All you've done is added one to 31.
You've made pubday = 32.
You have NOT added one day to a DATE. You have added the number 1 to the number 31.
This would be better:
VBEval>Day(Now+1),pubday
This adds one day to the current date and returns the day portion.
So your script would be:
VBSTART
VBEND
//This to set the new name with ho code
VBEval>Day(Now+1),pubday
VBEval>Right("0"&"%pubday%",2),pubday
Month>pubmonth
let>EditionCode=ho
let>EditionDate=%pubmonth%%pubday%
let>Product=tvgrid
let>Newname=%EditionCode%%pubmonth%_%pubday%___%EditionCode%%pubmonth%%pubday%%Product%.pdf
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?