Last day of the previous month Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
john890

Last day of the previous month  Topic is solved

27 May 2014, 05:35

Hello Everybody,

i'm new here so hello to all one more time.

I have a problem with date calculation. Namely, i need script to return the last day of the previous month.
Unfortunately, my code does not work at all.

My idea was to determine the first day of the present month and then subtract 1 to achieve last day of the previous one.
i need this date in format dd.mm.yyyy and i'm working in US windows

Here's the code:

leaveDate = 01/%A_YYYY%/%A_MM%
FormatTime, fileDate, leaveDate, 01.MM.yyyy

output_date := fileDate

listvars

;output_date += -1, days ; does not work

FormatTime, FormattedDate2, %output_date%, dd.MM.yyyy

MsgBox, %fileDate%
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: Last day of the previous month

27 May 2014, 11:36

Code: Select all

TDate := A_YYYY A_MM "01" ; Start Date of Current Month
TDate += -1, D            ; End Date of Previous Month 
FormatTime, fileDate, %TDate%, dd.MM.yyyy
MsgBox, %fileDate%
hth.
My Scripts and Functions: V1  V2
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Last day of the previous month

27 May 2014, 13:02

less talk and more code! test and hit the spot~ :lol:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, mapcarter, peter_ahk, Rohwedder and 293 guests