Date Calulations
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Date Calulations
Needing a Simple Date Calculation
[code]
GetDate>Date
Let>aDate = {(%Date%) + (31)}
MDL>%aDate%
[/code]
I tried this and got 06/28/201131
I would like to add xx# of days to Date
Thanks for any and all suggestions
Gil
[code]
GetDate>Date
Let>aDate = {(%Date%) + (31)}
MDL>%aDate%
[/code]
I tried this and got 06/28/201131
I would like to add xx# of days to Date
Thanks for any and all suggestions
Gil
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Date Calculations
adroege,
Thanks for the fast response
And I'm sorry but in my haste to post a message I failed to provide complete info about how I'm using this Date Calculation.
I'm not sure how to use the VBStart and VBEnd in this situation.
Maybe a function that I can call?
First it's a sub that's part of Dialog
[code]
SRT>subArvDate
GetDialogProperty>BolDialog,DischargePort,Text,DPort
If>Dport=JEDDAH
GetDate>ArvDate
Let>ArDate={(%ArvDate%) + (31)}
SetDialogProperty>BolDialog,ArrivalDate,Text,%ArDate%
EndIf
MDL>%ArDate%
END>subArvDate
[/code]
Gil
Thanks for the fast response
And I'm sorry but in my haste to post a message I failed to provide complete info about how I'm using this Date Calculation.
I'm not sure how to use the VBStart and VBEnd in this situation.
Maybe a function that I can call?
First it's a sub that's part of Dialog
[code]
SRT>subArvDate
GetDialogProperty>BolDialog,DischargePort,Text,DPort
If>Dport=JEDDAH
GetDate>ArvDate
Let>ArDate={(%ArvDate%) + (31)}
SetDialogProperty>BolDialog,ArrivalDate,Text,%ArDate%
EndIf
MDL>%ArDate%
END>subArvDate
[/code]
Gil
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Code: Select all
//stick these two lines right at the top of your script once and forget about them.
VBSTART
VBEND
..
..
..
//modify your subroutine thusly:
SRT>subArvDate
GetDialogProperty>BolDialog,DischargePort,Text,DPort
If>Dport=JEDDAH
GetDate>ArvDate
VBEval>DateAdd("d",31,"%ArvDate%"),ArDate
SetDialogProperty>BolDialog,ArrivalDate,Text,%ArDate%
EndIf
MDL>%ArDate%
END>subArvDate
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?
I nthis case you don't need vb. Just use the MS Add> function.
Code: Select all
SRT>subArvDate
GetDialogProperty>BolDialog,DischargePort,Text,DPort
If>Dport=JEDDAH
GetDate>ArDate
Add>ArDate,31
SetDialogProperty>BolDialog,ArrivalDate,Text,%ArDate%
EndIf
MDL>%ArDate%
END>subArvDate
-
- Pro Scripter
- Posts: 132
- Joined: Mon Dec 22, 2008 4:56 pm
- Location: St Augustine FL
Date Calculations
Thank you, Both
Just curious, is one faster then the other, when script is compiled?
Not that it's any real heavy lifting going on.
But inquiring minds just want know
Just curious, is one faster then the other, when script is compiled?
Not that it's any real heavy lifting going on.
But inquiring minds just want know
Code: Select all
VBSTART
VBEND
VBEval>timer,stime
Let>vbcount=0
Repeat>vbcount
Add>vbcount,1
GetDate>ArvDate
VBEval>DateAdd("d",31,"%ArvDate%"),ArDate
Until>vbcount=10000
VBEval>timer-%stime%,etime
mdl>VB time = %etime%
VBEval>timer,stime
Let>vbcount=0
Repeat>vbcount
Add>vbcount,1
GetDate>ArDate
add>ardate,31
Until>vbcount=10000
VBEval>timer-%stime%,etime
mdl>MS time = %etime%