Returning Day of Week based on Date

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
winstein
Pro Scripter
Posts: 84
Joined: Mon Nov 26, 2012 3:44 pm

Returning Day of Week based on Date

Post by winstein » Mon Jul 21, 2014 10:26 am

The DayOfWeek function found in the Macro Scheduler only allows the return of today's day of the week, from what I see. Is there any way to look at a certain date and return that day's day of the week?

Thanks for reading.
PPQ

hagchr
Automation Wizard
Posts: 331
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: Returning Day of Week based on Date

Post by hagchr » Mon Jul 21, 2014 10:43 am

Hi, try the following (where the second argument, 2, says that first day of week is Monday. You can select any weekday as start of week)

VBEval>Weekday("2014-07-21",2),res

MessageModal>res

  View Snippet Page

hagchr
Automation Wizard
Posts: 331
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: Returning Day of Week based on Date

Post by hagchr » Mon Jul 21, 2014 10:54 am

In case it was not clear, when you set Monday as start of week then, the the formula will return a 1 for Monday, 2 for Tuesday, etc. There is also a function WeekdayName which gives the day name in clear text.

VBEval>Weekday("2014-07-21",2),res
VBEval>WeekdayName(%res%,,2),res2

MessageModal>%res%, %res2%

  View Snippet Page

winstein
Pro Scripter
Posts: 84
Joined: Mon Nov 26, 2012 3:44 pm

Re: Returning Day of Week based on Date

Post by winstein » Tue Jul 22, 2014 8:04 am

Ah, I see. Thank you for your advice.
PPQ

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts