Last active
November 7, 2017 06:53
-
-
Save davebrny/d8a361412985c494e5b3a5a2954dde5c to your computer and use it in GitHub Desktop.
(autohotkey) - find how many days are in a given month
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
days_in_month(date="") { | |
date := (date = "") ? (a_now) : (date) | |
formatTime, year, % date, yyyy | |
formatTime, month, % date, MM | |
month += 1 ; goto next month | |
if (month > 12) | |
year += 1, month := 1 ; goto next year, reset month | |
month := (month < 10) ? (0 . month) : (month) ; 0 to 01 | |
new_date := year . month | |
new_date += -1, days ; minus 1 day | |
return subStr(new_date, 7, 2) | |
} | |
/* | |
[script info] | |
description = find how many days are in a given month | |
author = davebrny | |
*/ |
Author
davebrny
commented
Jan 24, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment