Jump to content

Calculating the date of the following Monday


Recommended Posts

Hi! This is my first post in this forum. I've been learining AutoIT gradually for the past 4 months writing automation scripts, one with a GUI for remote suppot. Now I've hit my first problem which i can't work out from the help files....

Our helpdesk system is a bit of a pain in the jacksee, so to make the job a bit easier when suspending a call I automated part of it in a script. Now I want to make it a bit more dynamic by getting the date of Monday on the following week.

I'm guessing it's along the lines of working out the week number based on the current date/time then getting the following Monday's date by advancing the week number, but the date functions are still giving me headaches.

Anyone with a greater knowledge of the date functions able to help me out here?

Thank you in advance.

Link to comment
Share on other sites

#include<date.au3>

$NextMonday = _DateAdd("d", 7 - _DateToDayOfWeekISO(@YEAR, @MON, @MDAY), _NowCalcDate())

ConsoleWrite('Next Monday is ' & $NextMonday & @CRLF)

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

#include<date.au3>

$NextMonday = _DateAdd("d", 7 - _DateToDayOfWeekISO(@YEAR, @MON, @MDAY), _NowCalcDate())

ConsoleWrite('Next Monday is ' & $NextMonday & @CRLF)

Mega

AHA! Thank you for your help > take the date, add 7 days then remove the ISO day number = works out the monday date.

One of those things where you can't see the forest for the trees. Thanks again!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...