Easy Date Converter Advanced Version Batch Processing Easy Date Converter Advanced can read an input file containing specified date operations, perform these and display the results in the output window, just as if they had been entered one at a time in the input boxes.
Click on Input file to specify the input file (or select from the drop-down list of previously-used input files).
Then click on Process file. If no errors in the input file are encountered then the results of the operations will appear in the output box. If an error occurs then an error message is printed, with the number of the offending line in the input file, e.g.:
Line 16, "2/29/2100", First date is not valid in calendar specified. (The first line is line number 1.) The output can then be copied to the clipboard and pasted into some application such as Wordpad, from where it can be printed or written to a text file.The input file must be a text file, with .txt extension. Each non-blank line must be of one of the following five types:
- A comment line
- An output line
- A process control line
- A configuration specification.
- An operation line
These will now be explained.
Examples of input files (and the resulting output) will now be given in this section and in the next two. The input files for these examples are contained in edca_examples.zip — click on that link to download the file.
- A comment line is any line beginning with //. Comments are skipped.
- An output line is either:
- bl
This produces a blank line- output: [text]
The given text is output. If the line has an appended semi-colon, as in "output: Today is;" then no newline is output, but a space is appended. If the line has two appended semi-colons, as in "output: .;;" then no newline is output and no space is appended.- display off, display on
The former suppresses output to the textbox, the latter restores it.- open file [filespec]
- This opens a disk file for output.
- If no file specification is given then the program writes to a file whose pathname is the pathname of the batch file with .output.txt appended (so, e.g., if the batch file is C:\jdns.txt then when the program finds open file it will begin sending output to the file C:\jdns.txt.output.txt).
- If a file specification is given then the file may be specified either by means of an absolute filepath (e.g., C:\aaa\bbb\ccc.txt) or a relative filepath (e.g., aaa.txt or aaa\bbb.txt).
- Output to a file does not suppress output to the screen.
- If a file has been opened and the textbox fills up then output to the file will continue.
- close file
This closes an open file.- append file [filespec]
- This opens an existing file to append further output.
- If no file specification is given then output is appended to the previously opened file (if any).
- This allows control over which parts of the batch file produce output to a file and which don't, by means of open-close, append-close, ...
- A file which has been opened must be closed before a subsequent open file or append file command can be used.
- A process control line controls processing of the statements in the input file. These are explained in the section entitled The EDC Programming Language. For simple batch processing it is not necessary to use any process control lines (though STOP and SKIP can be useful when testing a batch file).
- A configuration specification sets the date format, the type(s) of calendar for the first and second dates, etc. It is of one of the following types, where the text to the left of the = sign specifies the parameter being specified and to the right of the = sign is a list of possible values (read | as "or"):
- date format = Y-M-D | D-M-Y | M-D-Y | Y/M/D | D/M/Y | M/D/Y | Y.M.D | D.M.Y | M.D.Y
- thousands separator = 1,000 | 1.000 | 1000
- include first date = Y | N
- include weekend dates = Y | N
- verbose = Y | N
- hyphen = Y | N
- first date = CE | JC | JDN | ISO | LPM | LPW | ORD
- second date = CE | JC | JDN | ISO | LPM | LPW | ORD
Y = "Yes", N = "No", and the calendar abbreviations are:
- CE = Common Era Calendar
- JC = Julian Calendar
- JDN = Julian day number
- ISO = ISO 8601 Week Calendar
- LPM = Hermetic Leap Week Calendar with month dates, year-month-day
- LPW = Hermetic Leap Week Calendar with week dates, year-week-day
- ORD = Ordinal date
Spaces are ignored and no distinction is made between upper and lower case.
For any parameter which is not set by a configuration line, the setting which is specified in the user interface is used. Checking or unchecking the Verbose option affects the first few lines of output (e.g., whether or not the name of the input file is output).
Tab characters may be used in the input file instead of #. Thus an input file can be created in a spreadsheet program such as Excel and written as a tab-delimited, a.k.a. tab-separated, file to be used as input to the program.
- An operation line specifies the operation to be performed. In a "simple" batch file it has one of the following forms:
- first date
Convert the first date.- first date #
Same thing.- first date # date diff
Add/subtract date diff days to/from the first date.- first date # # second date
Calculate the number of days from first date to second.- # date diff # second date
Add/subtract date diff days to/from the second date.- # # second date
Convert the second date.where first date and second date are explicit dates, e.g. "2003-02-11" and date diff is a number (of days). Dates do not include calendar designations because the calendars of the first and second dates are set by configuration specifications (as stated above).
Clearly an operation line mirrors a combination of inputs in the input boxes, with the input data separated by #.
A more "complex" kind of batch file is possible, in which first date may be 'today' (today's date) or 'result' (the result of the previous operation), date diff may be 'result', and second date may be 'today'. This is explained in the section entitle Using 'today' and 'result'. first date, date diff and second date may even be variables, e.g. X, Y and Z; this is explained in the entitled The EDC Programming Language.
The simplest use of batch processing is to convert a sequence of dates in one date format to dates in another. Suppose you have a sequence of ordinal dates in the form YYYY-DDD which you wish to convert to the corresponding Common Era dates in the form M/D/Y. Here is an example of this (to get the output as below the Verbose checkbox should be checked, as also the Display day names box in the configuration panel):
Input file Result in output window
// Example A1 output: Converting ordinal dates; output: to Common Era dates. bl first date = ORD second date = CE date format = M/D/Y hyphen = Y bl 2003-044 2003-191 2003-277 2004-001 2004-033 2004-200 2004-366 2005-031 2005-210 2005-339
In effect: CE/JC Date format is Y-M-D, 1st date is CE, 2nd date is CE. First date not included. Weekend days are counted. Input file: C:\temp\a1.txt Converting ordinal dates to Common Era dates. CE/JC Date format is Y-M-D, 1st date is ORD, 2nd date is CE. CE/JC Date format is M/D/Y, 1st date is ORD, 2nd date is CE. Ordinal and ISO 8601 Week dates are with hyphen. 2003-044 = 02/13/2003 CE, Thursday 2003-191 = 07/10/2003 CE, Thursday 2003-277 = 10/04/2003 CE, Saturday 2004-001 = 01/01/2004 CE, Thursday 2004-033 = 02/02/2004 CE, Monday 2004-200 = 07/18/2004 CE, Sunday 2004-366 = 12/31/2004 CE, Friday 2005-031 = 01/31/2005 CE, Monday 2005-210 = 07/29/2005 CE, Friday 2005-339 = 12/05/2005 CE, MondayThe "In effect:" line states the settings in effect when the batch processing is started (this can be anything, but in this case was CE calendar for both first and second dates and ISO 8601 date format). As each configuration specification in the input file is processed a line is output which gives the new setting — unless verbose = N has been processed in the input file.
This is another simple case, similar to the first example. Suppose you have a sequence of CE dates in the form YYYY-MM-DD which you wish to convert to the corresponding ISO 8601 Week dates. Here is an example of this (to get the output as below the Verbose checkbox should be checked, and the Display day names box in the configuration panel should be unchecked):
Input file Result in output window
// Example A2 first date = CE date format = Y-M-D second date = ISO hyphen = Y bl 2010-12-31 2011-01-01 2011-12-31 2012-01-01 2012-12-31 2013-01-01 2013-12-31 2014-01-01 2014-12-31 2015-01-01 2015-12-31 2016-01-01 2016-12-31 2017-01-01 2017-12-31 2018-01-01 2018-12-31 2019-01-01 2019-12-31 2020-01-01
In effect: CE/JC Date format is Y-M-D, 1st date is CE, 2nd date is CE. First date not included. Weekend days are counted. Input file: C:\temp\a2.txt CE/JC Date format is Y-M-D, 1st date is CE, 2nd date is CE. CE/JC Date format is Y-M-D, 1st date is CE, 2nd date is ISO. Ordinal and ISO 8601 Week dates are with hyphen. 2010-12-31 CE = 2010-W52-5 ISO 2011-01-01 CE = 2010-W52-6 ISO 2011-12-31 CE = 2011-W52-6 ISO 2012-01-01 CE = 2011-W52-7 ISO 2012-12-31 CE = 2013-W01-1 ISO 2013-01-01 CE = 2013-W01-2 ISO 2013-12-31 CE = 2014-W01-2 ISO 2014-01-01 CE = 2014-W01-3 ISO 2014-12-31 CE = 2015-W01-3 ISO 2015-01-01 CE = 2015-W01-4 ISO 2015-12-31 CE = 2015-W53-4 ISO 2016-01-01 CE = 2015-W53-5 ISO 2016-12-31 CE = 2016-W52-6 ISO 2017-01-01 CE = 2016-W52-7 ISO 2017-12-31 CE = 2017-W52-7 ISO 2018-01-01 CE = 2018-W01-1 ISO 2018-12-31 CE = 2019-W01-1 ISO 2019-01-01 CE = 2019-W01-2 ISO 2019-12-31 CE = 2020-W01-2 ISO 2020-01-01 CE = 2020-W01-3 ISO
This example concerns the calculation of days between dates in the ISO 8601 Week Calendar. To obtain the output as below the Verbose option should be unchecked and the Hyphen in IS0 8601 Week dates option should be checked.
Input file Result in output window
// Example A3 first date = ISO second date = ISO include weekend dates = Y include first date = N 2002-W52-6 # # 2003-W01-7 2002-W52-7 # # 2003-W01-7 2003-W01-1 # # 2003-W01-7 2003-W01-1 # # 2003-W02-1 2003-W52-7 # # 2004-W51-7 2004-W01-1 # # 2004-W51-7 2004-W01-1 # # 2004-W52-1 2004-W01-1 # # 2004-W52-7 2004-W01-1 # # 2004-W53-1 2004-W01-1 # # 2004-W53-7 2004-W01-1 # # 2005-W01-1 bl include first date = Y 2002-W52-6 # # 2003-W01-7 2002-W52-7 # # 2003-W01-7 2003-W01-1 # # 2003-W01-7 2003-W01-1 # # 2003-W02-1 2003-W52-7 # # 2004-W51-7 2004-W01-1 # # 2004-W51-7 2004-W01-1 # # 2004-W52-1 2004-W01-1 # # 2004-W52-7 2004-W01-1 # # 2004-W53-1 2004-W01-1 # # 2004-W53-7 2004-W01-1 # # 2005-W01-1 bl include weekend dates = N include first date = N 2002-W52-6 # # 2003-W01-7 2002-W52-7 # # 2003-W01-7 2003-W01-1 # # 2003-W01-7 2003-W01-1 # # 2003-W02-1 2003-W52-7 # # 2004-W51-7 2004-W01-1 # # 2004-W51-7 2004-W01-1 # # 2004-W52-1 2004-W01-1 # # 2004-W52-7 2004-W01-1 # # 2004-W53-1 2004-W01-1 # # 2004-W53-7 2004-W01-1 # # 2005-W01-1 bl include first date = Y 2002-W52-6 # # 2003-W01-7 2002-W52-7 # # 2003-W01-7 2003-W01-1 # # 2003-W01-7 2003-W01-1 # # 2003-W02-1 2003-W52-7 # # 2004-W51-7 2004-W01-1 # # 2004-W51-7 2004-W01-1 # # 2004-W52-1 2004-W01-1 # # 2004-W52-7 2004-W01-1 # # 2004-W53-1 2004-W01-1 # # 2004-W53-7 2004-W01-1 # # 2005-W01-1
Weekend days are counted. First date not included. 2002-W52-6 ISO to 2003-W01-7 ISO = 8 days (1 week, 1 day) 2002-W52-7 ISO to 2003-W01-7 ISO = 7 days (1 week) 2003-W01-1 ISO to 2003-W01-7 ISO = 6 days 2003-W01-1 ISO to 2003-W02-1 ISO = 7 days (1 week) 2003-W52-7 ISO to 2004-W51-7 ISO = 357 days (51 weeks) 2004-W01-1 ISO to 2004-W51-7 ISO = 356 days (50 weeks, 6 days) 2004-W01-1 ISO to 2004-W52-1 ISO = 357 days (51 weeks) 2004-W01-1 ISO to 2004-W52-7 ISO = 363 days (51 weeks, 6 days) 2004-W01-1 ISO to 2004-W53-1 ISO = 364 days (52 weeks) 2004-W01-1 ISO to 2004-W53-7 ISO = 370 days (52 weeks, 6 days) 2004-W01-1 ISO to 2005-W01-1 ISO = 371 days (1 year) First date included. 2002-W52-6 ISO to 2003-W01-7 ISO = 9 days (1 week, 2 days) 2002-W52-7 ISO to 2003-W01-7 ISO = 8 days (1 week, 1 day) 2003-W01-1 ISO to 2003-W01-7 ISO = 7 days (1 week) 2003-W01-1 ISO to 2003-W02-1 ISO = 8 days (1 week, 1 day) 2003-W52-7 ISO to 2004-W51-7 ISO = 358 days (51 weeks, 1 day) 2004-W01-1 ISO to 2004-W51-7 ISO = 357 days (51 weeks) 2004-W01-1 ISO to 2004-W52-1 ISO = 358 days (52 weeks, 1 day) 2004-W01-1 ISO to 2004-W52-7 ISO = 364 days (1 year) 2004-W01-1 ISO to 2004-W53-1 ISO = 365 days (1 year, 1 day) 2004-W01-1 ISO to 2004-W53-7 ISO = 371 days (1 year, 1 week) 2004-W01-1 ISO to 2005-W01-1 ISO = 372 days (1 year, 1 day) Weekend days are not counted. First date not included. 2002-W52-6 ISO to 2003-W01-7 ISO = 5 days 2002-W52-7 ISO to 2003-W01-7 ISO = 5 days 2003-W01-1 ISO to 2003-W01-7 ISO = 4 days 2003-W01-1 ISO to 2003-W02-1 ISO = 5 days 2003-W52-7 ISO to 2004-W51-7 ISO = 255 days 2004-W01-1 ISO to 2004-W51-7 ISO = 254 days 2004-W01-1 ISO to 2004-W52-1 ISO = 255 days 2004-W01-1 ISO to 2004-W52-7 ISO = 259 days 2004-W01-1 ISO to 2004-W53-1 ISO = 260 days 2004-W01-1 ISO to 2004-W53-7 ISO = 264 days 2004-W01-1 ISO to 2005-W01-1 ISO = 265 days First date included. 2002-W52-6 ISO to 2003-W01-7 ISO = 5 days 2002-W52-7 ISO to 2003-W01-7 ISO = 5 days 2003-W01-1 ISO to 2003-W01-7 ISO = 5 days 2003-W01-1 ISO to 2003-W02-1 ISO = 6 days 2003-W52-7 ISO to 2004-W51-7 ISO = 255 days 2004-W01-1 ISO to 2004-W51-7 ISO = 255 days 2004-W01-1 ISO to 2004-W52-1 ISO = 256 days 2004-W01-1 ISO to 2004-W52-7 ISO = 260 days 2004-W01-1 ISO to 2004-W53-1 ISO = 261 days 2004-W01-1 ISO to 2004-W53-7 ISO = 265 days 2004-W01-1 ISO to 2005-W01-1 ISO = 266 days
This example shows results obtained when the first date is included or excluded, and when weekend dates are counted or not counted. All dates are in the Common Era Calendar. The operations are grouped in sets of three; the first operation adds a number of days (positive or negative) to 2005-08-01 (August 1st, 2005, in ISO 8601 format), the second calculates the number of days from 2005-08-01 to the second date, and the third works backward from that date by that number of days (in each case obtaining 2005-08-01). This is done initially in verbose mode, and later in non-verbose mode. Display day names in the configuration panel was unchecked. Lines in the verbose section of the output have been split (with indentation) for better display on this web page (best viewed at 1024x768).
Input file Result in output window
// Example A4 date format = Y-M-D first date = CE second date = CE verbose = Y include first date = N include weekend dates = Y 2005-08-01 # 31 2005-08-01 # # 2005-09-01 # 31 # 2005-09-01 bl include first date = Y include weekend dates = Y 2005-08-01 # 31 2005-08-01 # # 2005-08-31 # 31 # 2005-08-31 bl include first date = N include weekend dates = N 2005-08-01 # 31 2005-08-01 # # 2005-09-13 # 31 # 2005-09-13 bl include first date = Y include weekend dates = N 2005-08-01 # 31 2005-08-01 # # 2005-09-12 # 31 # 2005-09-12 bl // Now repeat with -31 // instead of 31. include first date = N include weekend dates = Y 2005-08-01 # -31 2005-08-01 # # 2005-07-01 # -31 # 2005-07-01 bl include first date = Y include weekend dates = Y 2005-08-01 # -31 2005-08-01 # # 2005-07-02 # -31 # 2005-07-02 bl include first date = N include weekend dates = N 2005-08-01 # -31 2005-08-01 # # 2005-06-17 # -31 # 2005-06-17 bl include first date = Y include weekend dates = N 2005-08-01 # -31 2005-08-01 # # 2005-06-20 # -31 # 2005-06-20 bl // Now repeat with 365 // instead of -31 // and no verbosity. verbose = N include first date = N include weekend dates = Y 2005-08-01 # 365 2005-08-01 # # 2006-08-01 # 365 # 2006-08-01 bl include first date = Y include weekend dates = Y 2005-08-01 # 365 2005-08-01 # # 2006-07-31 # 365 # 2006-07-31 bl include first date = N include weekend dates = N 2005-08-01 # 365 2005-08-01 # # 2006-12-25 # 365 # 2006-12-25 bl include first date = Y include weekend dates = N 2005-08-01 # 365 2005-08-01 # # 2006-12-22 # 365 # 2006-12-22 bl // Now repeat with 1461 // instead of 365. verbose = N include first date = N include weekend dates = Y 2005-08-01 # 1461 2005-08-01 # # 2009-08-01 # 1461 # 2009-08-01 bl include first date = Y include weekend dates = Y 2005-08-01 # 1461 2005-08-01 # # 2009-07-31 # 1461 # 2009-07-31 bl include first date = N include weekend dates = N 2005-08-01 # 1461 2005-08-01 # # 2011-03-08 # 1461 # 2011-03-08 bl include first date = Y include weekend dates = N 2005-08-01 # 1461 2005-08-01 # # 2011-03-07 # 1461 # 2011-03-07
2005-08-01 CE plus 31 days = 2005-09-01 CE, excluding 1st date 2005-08-01 CE to 2005-09-01 CE = 31 days, excluding 1st date (1 month) 2005-09-01 CE minus 31 days = 2005-08-01 CE, excluding 1st date 2005-08-01 CE plus 31 days = 2005-08-31 CE, including 1st date 2005-08-01 CE to 2005-08-31 CE = 31 days, including 1st date 2005-08-31 CE minus 31 days = 2005-08-01 CE, including 1st date 2005-08-01 CE plus 31 days = 2005-09-13 CE, excluding 1st date, not counting weekend days 2005-08-01 CE to 2005-09-13 CE = 31 days, excluding 1st date, not counting weekend days 2005-09-13 CE minus 31 days = 2005-08-01 CE, excluding 1st date, not counting weekend days 2005-08-01 CE plus 31 days = 2005-09-12 CE, including 1st date, not counting weekend days 2005-08-01 CE to 2005-09-12 CE = 31 days, including 1st date, not counting weekend days 2005-09-12 CE minus 31 days = 2005-08-01 CE, including 1st date, not counting weekend days 2005-08-01 CE minus 31 days = 2005-07-01 CE, excluding 1st date 2005-08-01 CE to 2005-07-01 CE = -31 days, excluding 1st date 2005-07-01 CE plus 31 days = 2005-08-01 CE, excluding 1st date 2005-08-01 CE minus 31 days = 2005-07-02 CE, including 1st date 2005-08-01 CE to 2005-07-02 CE = -31 days, including 1st date 2005-07-02 CE plus 31 days = 2005-08-01 CE, including 1st date 2005-08-01 CE minus 31 days = 2005-06-17 CE, excluding 1st date, not counting weekend days 2005-08-01 CE to 2005-06-17 CE = -31 days, excluding 1st date, not counting weekend days 2005-06-17 CE plus 31 days = 2005-08-01 CE, excluding 1st date, not counting weekend days 2005-08-01 CE minus 31 days = 2005-06-20 CE, including 1st date, not counting weekend days 2005-08-01 CE to 2005-06-20 CE = -31 days, including 1st date, not counting weekend days 2005-06-20 CE plus 31 days = 2005-08-01 CE, including 1st date, not counting weekend days First date not included. Weekend days are counted. 2005-08-01 CE plus 365 days = 2006-08-01 CE 2005-08-01 CE to 2006-08-01 CE = 365 days (1 year) 2006-08-01 CE minus 365 days = 2005-08-01 CE First date included. Weekend days are counted. 2005-08-01 CE plus 365 days = 2006-07-31 CE 2005-08-01 CE to 2006-07-31 CE = 365 days (11 months, 30 days) 2006-07-31 CE minus 365 days = 2005-08-01 CE First date not included. Weekend days are not counted. 2005-08-01 CE plus 365 days = 2006-12-25 CE 2005-08-01 CE to 2006-12-25 CE = 365 days 2006-12-25 CE minus 365 days = 2005-08-01 CE First date included. Weekend days are not counted. 2005-08-01 CE plus 365 days = 2006-12-22 CE 2005-08-01 CE to 2006-12-22 CE = 365 days 2006-12-22 CE minus 365 days = 2005-08-01 CE First date not included. Weekend days are counted. 2005-08-01 CE plus 1,461 days = 2009-08-01 CE 2005-08-01 CE to 2009-08-01 CE = 1,461 days (4 years) 2009-08-01 CE minus 1,461 days = 2005-08-01 CE First date included. Weekend days are counted. 2005-08-01 CE plus 1,461 days = 2009-07-31 CE 2005-08-01 CE to 2009-07-31 CE = 1,461 days (3 years, 11 months, 30 days) 2009-07-31 CE minus 1,461 days = 2005-08-01 CE First date not included. Weekend days are not counted. 2005-08-01 CE plus 1,461 days = 2011-03-08 CE 2005-08-01 CE to 2011-03-08 CE = 1,461 days 2011-03-08 CE minus 1,461 days = 2005-08-01 CE First date included. Weekend days are not counted. 2005-08-01 CE plus 1,461 days = 2011-03-07 CE 2005-08-01 CE to 2011-03-07 CE = 1,461 days 2011-03-07 CE minus 1,461 days = 2005-08-01 CE
To be noted here is that, when the Verbose option is in effect, the configuration lines regarding inclusion or exclusion of the first date, and inclusion or exclusion of weekend days, do not generate any line in the output. When not in effect, these configuration lines cause output such as:
First date not included. Weekend days are counted.
Easy Date Converter Advanced Version Main Page Date/Calendar Software Hermetic Systems Home Page