Calculation Date

Discussion, questions and support.
Post Reply
Juan
Posts: 2
Joined: Oct 24th, ’14, 04:25

Post by Juan » Nov 25th, ’14, 14:21

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 ?
User avatar
Marko
Posts: 1730
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Nov 25th, ’14, 17:09

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
Posts: 2
Joined: Oct 24th, ’14, 04:25

Post by Juan » Nov 26th, ’14, 08:15

Great .

I love your app .

Thank you very much .
car54
Posts: 5
Joined: May 2nd, ’17, 00:15

Post by car54 » Jul 19th, ’17, 13:28

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.
User avatar
Marko
Posts: 1730
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Jul 20th, ’17, 20:45

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
car54
Posts: 5
Joined: May 2nd, ’17, 00:15

Post by car54 » Jul 20th, ’17, 22:01

Brilliant! Just what I needed. Thanks so much.
Post Reply