Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
Esabik
- Pro Scripter
- Posts: 52
- Joined: Wed Jun 15, 2005 8:03 pm
- Location: Fairfield, NJ
Post
by Esabik » Thu Jan 23, 2014 9:43 pm
Hi
Was trying to add 2 weeks to current date but not understanding the correct euqation format in the scripting. I need it as a parameter for a report I am running and will ultimately need to send the date format as a sendtext to a criteria field on my report like this 02/10/2014. I cant seem to figure out the addition of the 14 days. Here is what I got so far:
GetDate>date
let>2weeks=(date+14)
Let>msg=The Date Is :
ConCat>msg,2weeks
Messagemodal>msg
Sendtext>"%2weeks%"
How close is this so far? I am using the modal just so i can see the progress/calculation if it was to work......

Just when you thought it was safe to go in the water........

-
JRL
- Automation Wizard
- Posts: 3532
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Thu Jan 23, 2014 10:31 pm
Take a look
HERE.
Based on that thread and rearranged for your desired output, this should work for you.
Code: Select all
VBSTART
VBEND
Let>TwoWeeks=14
VBEval>right("00" & Month(now+%TwoWeeks%),2) & "/" & right("00" & Day(now+%TwoWeeks%),2) & "/" & right ("20" & Year(now+%TwoWeeks%),4),FormattedDate
mdl>FormattedDate
-
CyberCitizen
- Automation Wizard
- Posts: 724
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Post
by CyberCitizen » Fri Jan 24, 2014 5:56 am
GetDate:
The format of the date depends on the regional settings of the system.
Code: Select all
GetDate>vToday
DateAdd>vToday,W,2,vTwoWeeks
MDL>Today's Date: %vToday%%CRLF%Two Weeks: %vTwoWeeks%
FIREFIGHTER
-
Esabik
- Pro Scripter
- Posts: 52
- Joined: Wed Jun 15, 2005 8:03 pm
- Location: Fairfield, NJ
Post
by Esabik » Fri Jan 24, 2014 3:43 pm
JRL wrote:Take a look
HERE.
Based on that thread and rearranged for your desired output, this should work for you.
Code: Select all
VBSTART
VBEND
Let>TwoWeeks=14
VBEval>right("00" & Month(now+%TwoWeeks%),2) & "/" & right("00" & Day(now+%TwoWeeks%),2) & "/" & right ("20" & Year(now+%TwoWeeks%),4),FormattedDate
mdl>FormattedDate
JRL thanks this is what I needed. I am still on V12 here so..... that works well. Though I must admit it looks quite complicated expressed that way lol when compared to what I thought it might look like as in my original post. Question now, how come what I started with won't work or something along those lines?? The date format on my system is using the correct format originally and I see what you did makes sure it hits that format.
Just when you thought it was safe to go in the water........

-
JRL
- Automation Wizard
- Posts: 3532
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Fri Jan 24, 2014 5:26 pm
Question now, how come what I started with won't work or something along those lines??
The Let> function doesn't add date / time information and that's why your original attempt doesn't work. The DateAdd> function (that you don't have yet) works using the local settings so there would be no guarantee the date would be formatted correctly.
You could use the Add> function which does add days onto dates correctly but it doesn't provide the 10 character output format you requested when months or days are single character numbers. For example today's output on my defaulted local settings is 2/7/2014. So you would have to add code that broke the date into its component parts, padded zeros on the month and day then reassembled the parts as a date.
Code: Select all
GetDate>today
Add>Today,14
mdl>today
Separate>Today,/,Element
Length>Element_1,len
If>len=1
Let>Element_1=0%Element_1%
EndIf
Length>Element_2,len
If>len=1
Let>Element_2=0%Element_2%
EndIf
Let>Today=%Element_1%/%Element_2%/%Element_3%
mdl>today