DateFormat latest version is 3.11.0.0 and a .Net 4.x release can also be downloaded.
Main feature overview
DateFormat is a program to generate dates in the format you want regardless of the current regional date format of the server or currently logged on user. The returned date can be used in Windows batches (.bat, .cmd), PowerShell (.ps1) or scheduled tasks. The program Dateformat can also perform several date calculations and lookups. DateFormat version 3.11 is free.
The first version of DateFormat was written to support Enterprise Resource Planning (ERP) batches migrated from the Unisys mainframes. DateFormat now runs on the command line, in batches, in PowerShell scripts and was build using the latest technology (Visual Studio C#).
Features
The program DateFormat is very easy to use, but very flexible. Just provide a format string where
yyyy stands for century and year,
with yy you only get the short year notation without
the century. mm stands for month and
dd stands for days. The date separator characters can be chosen out of "-", "." or "/"
Format
Short Format
Explanation
Example
yyyy-mm-dd
-
Generates the current date in the international ISO Date notation standard (ISO 8601). This date format is ideal for
batched based comparisons and sorting routines.
2024-11-08
dd-mm-yyyy
dd-mm-yy
A more human readable European date format.
08-11-2024
08-11-24
yyyymmdd
yymmdd
A condensed format for use in short filenames and or directories.
20241108
241108
dd/mm/yyyy
dd/mm/yy
A more human readable format.
08/11/2024
08/11/24
yyyy/dd/mm
yy/mm/dd
A format that also can be used for creating dated directory structures.
2024/11/08
24/11/08
dd.mmm.yyyy
dd.mmm.yy
A format mostly used in German speaking regions.
20.Jan.2024
20.Jan.24
License
The program DateFormat is licensed according to the EULA in the download. Read the EULA carefully before using the program. A recent copy can be downloaded here
YOU AGREE TO BE BOUND BY THE TERMS OF THIS EULA BY INSTALLING, COPYING, OR OTHERWISE USING THE SOFTWARE. IF YOU DO NOT AGREE, DO NOT INSTALL, COPY, OR USE THE SOFTWARE.
Manual
The program DateFormat has, next to several date formats, received several additional options during the last versions. These options give you the possibility to perform date calculations and lookups. The current options are and only one can be selected:
Option
Explanation
/ADx
Add x Days to current date
/SDx
Subtract x Days from current date
/AMx
Add x Months to current date
/SMx
Subtract x Months from current date
/AYx
Add x Years to current date
/SYx
Subtract x Years from current date
/BM
Begin of Month from current date
/EM
End of Month from current date
/BQ
Begin of Quarter from current date
/EQ
End of Quarter from current date
The variable x must be an integer.
By typing DateFormat without any optional parameters, DateFormat will show its options and examples.
Examples
The following Windows batch example creates every day a unique new log file and writes the current date in it.
Rem Example for the program DateFormat
Rem (C)Copyright 2014-2024 vanSoest.it by Johan van Soest
Rem ***** Create a log file with current date in the name
For /f %%i In ('DateFormat "YYYYMMDD"') Do (Set OutputDate=%%i)
Echo %OutputDate%
Set LogFile=%OutputDate%_Important_Log.Txt
Echo Current date is %OutputDate% >> %LogFile%
The next Windows batch example deletes a log file that is 14 days old.
Rem Example for the program DateFormat
Rem (C)Copyright 2014-2024 vanSoest.it by Johan van Soest
Rem ***** Remove file that is 14 days old
For /f %%i In ('DateFormat "YYYYMMDD" /SD14') Do (Set OutputDate=%%i)
Echo %OutputDate%
If Exist %OutputDate%_Important_Log.Txt Del %OutputDate%_Important_Log.Txt
This Windows batch example uses DateFormat to create a directory/folder structure
Rem Example for the program DateFormat
Rem (C)Copyright 2014-2024 vanSoest.it by Johan van Soest
For /f %%i In ('DateFormat "YYYY\\MM\\DD"') Do (Set OutputDate=%%i)
md %OutputDate%
Example output directory structure created
C:.
+---2024
+---11
+---08
This Windows PowerShell example uses DateFormat called with several options
# ****************************************************
# * This PowerShell demo shows some ways to call
# * the program DateFormat from PowerShell (ISE)
# * (C) Copyright 2014 - 2024 vanSoest.it by Johan van Soest
# ****************************************************
cls
$data = C:\batch\DateFormat.exe yyyymmdd
Write-Host "Today is $data"
$data = C:\batch\DateFormat.exe yyyymmdd /sd1
Write-Host "Yesterday it was $data"
$data = C:\batch\DateFormat.exe yyyymmdd /eq
Write-Host "The last day of current quarter is $data"
$data = C:\batch\DateFormat.exe yymmdd /bq
Write-Host "The first day of current quarter is $data"
Previous Releases
The following table shows you the history of the DateFormat project.
Version
Features
3.11
Added support for Begin of Month, End of Month Options (/BM, /EM) and Begin Quarter and End Quarter (/QB /QE)
Programmed in Microsoft C# .Net.
A for .Net 4.x or newer compiled version is available and can be recognised using the help text:
*******************************************************************************
* DateFormat Version 3.11 (for .net 4) *
* (C)Copyright 2013 - 2024 vanSoest.it by J. van Soest *
*******************************************************************************
3.1
Added support for more subtraction and addition options to current system date:
/ADx Add x Days
/AMx Add x Months
/SMx Subtract x Months
/AYx Add x Years
/SYx Subtract x Years
Programmed in Microsoft C# .Net
3.0
Program ported to Microsoft C# .Net for:
improved compatibility with 64 bit operating systems, so there is no need to start a WOW64 environment for running 32 bit applications
the Borland Turbo Delphi developer suite is cancelled by Embarcadero
TimeFormat is never used so no port to Microsoft C#.Net has been made.
2.0
The program DateFormat is accompanied by TimeFormat.
Programmed in Borland Turbo Delphi.
1.1
Added support for subtraction of a number of days from the current date. By providing the /SD14 option the program
DateFormat will subtract 14 days from the current date and generates a valid date that is two weeks in the past
Programmed in Borland Turbo Delphi.
1.0
The great program DateFormat can now accept a format option. So it is now possible to provide format strings such as
"YYYY-MM-DD" or "DD/MM/YYYY" and the date is formatted accordingly.
Programmed in Borland Turbo Delphi.
0.1
The program DateFormat generates the current date in the international ISO-standard (ISO 8601) format
"YYYY-MM-DD". This date can be used in batches or scheduled tasks.
The generated date is independent of the current localization (Regional settings) of the system. So if your current date format is
mm/dd/yy, this program will always generate a date according to the international ISO 8601 standard.
Programmed in Borland Delphi.
Installation
Download, unzip and copy the program DateFormat anywhere you want on the disk.
System requirements
DateFormat is designed for the .NET platform with Microsoft C#. Therefore
Microsoft .NET Framework 2.0 or 4.0 or newer is required.
Windows Version
Runs .Net 2.0
Tested
Windows XP
Yes
Yes
Windows Vista
Yes
No
Windows 7
Yes
Yes
Windows 8.1
Yes
No
Windows 10
Yes
Yes
Windows Server 2008 SP2
Yes
Yes
Windows Server 2008 R2 SP1
Yes
Yes
Windows Server 2012
Yes
Yes
Windows Server 2012 R2
Yes
Yes
Windows Server 2016
Yes
Yes
Now a .Net 4.x version is available for machines that default do not include .Net 2.0 (Windows server 2012, 2012 r2 and 2016). It is also available from the download page.
Support matrix
vanSoest.it will only support the latest version of free software.
Download
Upon clicking the "Start download process" button, you get to another web page where you have to agree to the End User License Agreement (EULA) before you can download the program DateFormat.
Frequently Asked Questions (FAQ)
Just use the postcard icon in the left menu to ask a question.
You may vote your opinion about this article:
Scripts and programming examples disclaimer
Unless stated otherwise, the script sources and programming examples provided are copyrighted freeware.
You may modify them, as long as a reference to the original code and hyperlink to the source page is included in the modified code and documentation.
However, it is not allowed to publish (copies of) scripts and programming examples on your own site, blog, vlog, or distribute them on paper or any other medium, without prior written consent.
Many of the techniques used in these scripts, including but not limited to modifying the registry or system files and settings, impose a risk of rendering the Operating System inoperable and loss of data.
Make sure you have verified full backups and the associated restore software available before running any script or programming example.
Use these scripts and programming examples entirely at your own risk. All liability claims against the author in relation to material or non-material losses caused by the use, misuse or non-use of the information provided, or the use of incorrect or incomplete information, are excluded. All content is subject to change and provided without obligation.