Hi Folks,
I have the following code returning 06/03/2002 & 06/03/0201, respectively. If I run it again I get a completely different set of dates.
DayOfWeek>dow
GetDate>the_date
Sub>the_date,{%dow%-1}
SetFocus>Report Options
Send> %the_date%
Press Tab
Send> %the_date%
What am I doing wrong?
DayOfWeek -1 returning odd date
Moderators: Dorian (MJT support), JRL
Re: DayOfWeek -1 returning odd date
I'm getting closer but can't figure out why the following produces a date formatted as mm/d/yyyy. When I run the same code and comment out 'Let>dd=dd-1 the result is proper at mm/dd/yyyy. Why does subtracting 1 from the date remove the leading zero? How and I fix this?
Press Enter
Month>mm
Day>dd
Year>yyyy
Let>dd=dd-1
MessageModal>%mm%/%dd%/%yyyy%
Press Enter
Month>mm
Day>dd
Year>yyyy
Let>dd=dd-1
MessageModal>%mm%/%dd%/%yyyy%
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: DayOfWeek -1 returning odd date
Code: Select all
Month>mm
Day>dd
Year>yyyy
Let>dd=dd-1
If>dd<10
Let>dd=0%dd%
Endif>
MessageModal>%mm%/%dd%/%yyyy%
Re: DayOfWeek -1 returning odd date
brilliant, thank you so much!
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: DayOfWeek -1 returning odd date
Great, but a reflection: what do you do if the current day is the first day of the month? The code above would then compute a date with invalid number, i.e 06/00/2018
Re: DayOfWeek -1 returning odd date
that's a good question... so can I simply say today-1?
edit:
yes, yes I can...
GetDate>today
DateAdd>today,dd,-1,strDate
MessageModal>%strDate%
edit:
yes, yes I can...
GetDate>today
DateAdd>today,dd,-1,strDate
MessageModal>%strDate%