I am trying to get the previous days date, and I ran across this code in the 'Tips' section:
GetDate>today
Sub>today,1
MidStr>today,1,2,d
Let>d=d-1
If>d=0,Start
Goto>End
Label>Start
..
Message>Today Is The Last Day of The Month!
..
Label>End
The problem is that when I try to run this, I get an error on the 'Sub' statement: 'Invalid Numeric or Date Format'
Our dates are in a mm/dd/yyyy format - is this the problem? If so, how can I change the format? Any help would be greatly appreciated!!
Thanks!
problem with Add/Sub and date
Moderators: Dorian (MJT support), JRL
problem with Add/Sub and date
Hi,
correct me if I'm wrong,
the GetDate>command takes the local (regional) setting from your PC.
The complete date string e.g. "10/28/2002" is difficult to sub cause it's not a numeric value!
If you would use the Day>command instead, it takes just the days value "28" which shouldn't be a problem to process.
Rgds.
Ernest
Check this out:
correct me if I'm wrong,
the GetDate>command takes the local (regional) setting from your PC.
The complete date string e.g. "10/28/2002" is difficult to sub cause it's not a numeric value!
If you would use the Day>command instead, it takes just the days value "28" which shouldn't be a problem to process.
Rgds.
Ernest
Check this out:
Code: Select all
Day>today
Month>month
Year>year
Let>Date, %month%/%today%/%year%
Sub>today,1
MidStr>today,1,2,d
Let>d=d-1
If>d=0,Start
Goto>End
Label>Start
..
Message>%Date% is definitely the last day of this month! %CRLF%Trust me !
..
Label>End
problem with Add/Sub and date - second try :-)
Expect the unexpected
I've cut&pasted your script to create the local script for testing (which I assume you've done with the sample script).
Had the same problem.
I checked the variable(s). And guess, the GetDate>result variable has had an additional "invisible" space at the end*.
So we've tried to process an "unknown" (cause spaceless) and therefore empty variable with the sub>command!!!
After I've replaced the variable with the "original" matching one, your script hasn't stopped. Bingo.
Please ignore the c... I've posted prior to this
Ernest
*It's somethig I've often recognized with MSched, after I've saved a script to run it from scratch.
I've cut&pasted your script to create the local script for testing (which I assume you've done with the sample script).
Had the same problem.
I checked the variable(s). And guess, the GetDate>result variable has had an additional "invisible" space at the end*.
So we've tried to process an "unknown" (cause spaceless) and therefore empty variable with the sub>command!!!
After I've replaced the variable with the "original" matching one, your script hasn't stopped. Bingo.
Please ignore the c... I've posted prior to this
Ernest
*It's somethig I've often recognized with MSched, after I've saved a script to run it from scratch.
[b]Thanks!!!!![/b]
I'm a happy camper!!