Printer Version Table of Contents Project Home Page
.EXAMPLE.....: 45 Get information about the month prior to the current month
.CATEGORY....: examples
.DISCUSSION..:
When running a monthly backup job at the beginning of the month, one often needs to identify the previous month, or the last day of the previous month. Here's how to use Fdate to obtain that sort of information. Basically, we subtract one day from the first day of the current month, giving us the last day of the previous month.

.CODE........:
@echo off
cls
:: ---------------------------------------------------------------------
:: The simplest way to get information about last month is to subtract
:: 1 day from the first day of this month ...
:: ---------------------------------------------------------------------

Fdate /Fsub /n1 /att-01-tttt /omm   /p"Last month was.................: "
Fdate /Fsub /n1 /att-01-tttt /occyy /p"Last month occurred in the year: "
Fdate /Fsub /n1 /att-01-tttt /odd   /p"The last day of last month was : "
Fdate /Fsub /n1 /att-01-tttt /od1   /p"The last day of last month was : "