Printer Version Table of Contents Project Home Page
.EXAMPLE.....: 17 Set your PC's date to a business Julian date
.CATEGORY....: examples
This batch file was created by Aran Spence [CIS: 70162,3044]. Its function is to emulate the DOS DATE command, but allow the user to set the date using a business Julian date format (yyjjj) instead of mm-dd-yy.

Note the format is YYjjj. This is the BUSINESS Julian date: a date expressed as the number of days from the beginning of the year, when January 1 is day 1.

           date      BUSINESS Julian date
       -----------   --------------------
       Jan 5, 1992       92005
       Jan 5, 1993       93005
       Dec 31, 1993      93365  [Dec 31 is 365th day of year 1993]
As Aran originally wrote it, the user-prompt was virtually identical to that of the DATE command. I have modified his original version, so it now looks less like the DATE command but displays a bit more information, and so it can operate from the command line.

If the user enters a business Julian date as a command-line parameter, JDATE resets the date to that Julian date.

EXAMPLE: JDATE 92005 If there is no input parameter, /fget is used to prompt the user for a date.

Note that the user must enter both of the year digits (yy), but may enter an abbreviated set of day digits (jjj). That is, for Julian day 92005, the user is permitted to enter 925.

One handy use for JDATE is simply to find out what the current business Julian date is.

@echo off

SET NewJD=%1
if not (%NewJD%)==() goto GotDate

Fdate /Ff /Od1    /P"Current Gregorian date: "
Fdate /Ff /Oyyjjj /P"'Business Julian' date: "

GET S "Enter new date (yyddd): " /VNewJD /L
if (%NewJD%)==() goto endit

Fdate /Ff /A%NewJD% /Omm-dd-yy /Iyyjjj /VNewGD
if errorlevel 1 echo Invalid date "%NewJD%"
if errorlevel 1 goto GetDate

::   reset the date

Fdate /Ff /Od1    /P"Current Gregorian date: "
Fdate /Ff /Oyyjjj /P"'Business Julian' date: "