Calculation Date

Discussion, questions and support.
Juan González

Calculation Date

PostPosted by Juan González » Tue Nov 25, 2014 2:21 pm

For the module TextExpander , you may get something like the date format DDMMYYYY 20 days ago?
Is it possible to subtract or add days to the current date and get the result with % A_DD %% %% A_YYYY % A_MM format ?[list=][/list]

Site Admin
User avatar
Posts: 642
Joined: Sat Mar 02, 2013 9:02 pm

Re: Calculation Date

PostPosted by Marko » Tue Nov 25, 2014 5:09 pm

Possible, of course. :D

You need to use the Type: Command
Code: Select all
Date:=A_Now
Date+=-20, Days
FormatTime, Date, %Date%, dd/MM/yyyy
Send, 20 days from now was %Date%.

There are many other possibilities: http://www.autohotkey.com/docs/commands/FormatTime.htm

Juan González

Re: Calculation Date

PostPosted by Juan González » Wed Nov 26, 2014 8:15 am

Great .
I love your app .
Thank you very much .

Posts: 2
Joined: Mon May 01, 2017 11:15 pm

Re: Calculation Date

PostPosted by car54 » Wed Jul 19, 2017 12:28 pm

I like your code above.

But I would like to show a future date in 8 business days (excluding Saturday and Sunday) What adjustment do I need to make to the code to allow for non-delivery on weekend days?

Date:=A_Now
Date+=+8, Days
FormatTime, Date, %Date%, dd/MM/yyyy
Send, 8 business days from now is%Date%.

Much appreciated for your help.

Site Admin
User avatar
Posts: 642
Joined: Sat Mar 02, 2013 9:02 pm

Re: Calculation Date

PostPosted by Marko » Thu Jul 20, 2017 7:45 pm

Code: Select all
Days:=8
BDays := 0
While (BDays < Days)
{
  Today += 1, D
  FormatTime, WDay, %Today%, WDay
  If (Wday <> 1) && (WDay <> 7) ; not Sunday and not Saturday
    BDays++
}
FormatTime, Date, %Today%, dd/MM/yyyy

Send, %Days% business days from now is %Date%.


Original code from https://autohotkey.com/boards/viewtopic.php?t=1818

Posts: 2
Joined: Mon May 01, 2017 11:15 pm

Re: Calculation Date

PostPosted by car54 » Thu Jul 20, 2017 9:01 pm

Brilliant! Just what I needed. Thanks so much.

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests