SETDATE.TXT Version 1.B 1994.09.18 ÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄ sample data: YR MTH DAY HR MIN SEC HTH DOW DL TODAY DFS LY NY TDAY UDAY CM CD WOY NM P4 3 8 P5 720 880 AD5 1 AD3 -30 = Those variables that the user wants to have in his environment are found before the first "=" sign at the start of this file. SETDATE.COM reads this documentation file to determine which of the variables is required. The set of possible variables is: YR MTH DAY HR MIN SEC HTH DOW D3 DL TODAY TMTH UMTH DFS DTE WOM LY NY CENT TH UH TM UM TS US THU UHU 12H TDAY UDAY CM CD WOY NM MX P0, P1..P9 AD0, AD1..AD9 The P variables (period) are P0, P1 to P9 and are used as period indicators. If one of these is used, it must be followed by 2 numbers representing the start and end of the period. if the numbers are both <= 24, the numbers are taken as hours, otherwise they are taken as minutes. If your data is P4 12 14, you will get an output of SET P4=Y if the program is run between 12:00 and 14:00 hrs, and SET P4=N otherwise. You can have a period extending past midnight with numbers like 23 7. Variables AD0, AD1..AD9 (Another Date) enable you to get the day, month and year of a date which is a given number of days from the present. AD3 1 will give something similar to SET AD3D=23 SET AD3M=08 SET AD3Y=94 representing tomorrows date. Previous dates are found by using negative numbers - the date 30 days ago is given by using a negative value of 30 (AD8 -30). Use of time and date environment variables:- Having parts of the date and time in environment variables is handy when making backups, or otherwise naming files or directories according to date. The program SETDATE results in an output which may be redirected to make a batch file, which then is CALLed to create the nominated environment variables as described below. You can change the behaviour of a batch file depending on the time of day by using the period variables. SETDATE provides time variables down to hundredths of seconds and has a ready- made combination called TODAY which may be convenient. The DOW (Day Of Week) variable is available at 2 characters to enable a file name like 941205Tu.txt to be made. A 3 character day and long version of day are available. Minutes or seconds may be useful in doing intermediate backups of source code when compiling via a batch file and can be used several times per day. Hundredths may be useful in providing a random seed for games, display of screens or other events. The program stops and warns if the system year is not at least 1994. Ways to use SETDATE are shown in examples below. If any of the variable names appear at the start of this file before "=" and the program is run from the same directory as the documentation file (or consider using the APPEND command), those variables will be written out with the current data (so keep a standard list and just copy it to the top and edit it there). Order and spacing do not matter, case does (so you could include a lower case note in the list). Just run the program to see what your selection will bring. When satisfactory, redirect it to a batch file and call it. If most names are used, the output looks something like this: SET TODAY=940515 SET YR=94 SET TMTH=0 SET UMTH=5 SET MTH=05 SET MX=5 SET THU=6 SET UHU=0 SET HTH=60 SET TDAY=1 SET UDAY=5 SET NM=0803 SET WOM=3 SET DAY=15 SET HR=13 SET TH=1 SET UH=3 SET 12H=1 SET MIN=23 SET TM=2 SET UM=3 SET SEC=37 SET TS=3 SET US=7 SET LY=1993 SET NY=1995 SET CENT=19 SET DOW=Su SET D3=Sun SET DL=Sunday SET CD=u SET CM=y SET DFS=135 SET WOY=20 SET DTE=230 but you will probably want to be selective about what to include. --------------------------------------------------------------------------- SETTODAY may called from the AUTOEXEC.BAT file but in addition, may be called from any other batch file or run separately. This file, SETTODAY.BAT or something like it, is what is required to make the variables (the directory \UTIL contains SETDATE.DOC and there is a path to SETDATE.COM): :settoday.bat rem change directory to where the data file is cd\util setdate >c:\setdate.bat call c:\setdate --------------------------------------------------------------------------- EXAMPLES: ÄÄÄÄÄÄÄÄÄ :File: ec.bat rem Edit the file of data captured from the bulletin board, then rename. ed caught.txt/e ren caught.txt %yr%%mth%%day%%min%.txt :File: nl.bat :new letter rem A 2 character command line parameter is allowed to enable the creation rem of lots of letters every day. The $ in the directory name makes it sort rem to the top of the tree. ed c:\$geoff\%yr%%mth%%day%%1.txt :dt.bat G.Cutter 93.11.08 :done today :(for Australia - order the variables to suit your country) dir /on |find "%day%-%mth%-%yr%" @echo off :test.bat G.Cutter 93.01.10 : Data was P8 15 19 rem "Display the file if in period 8" if .%P8%==.Y goto showit goto missit :showit type c:\config.sys pause :missit @echo off :setmthc.bat Geoff Cutter 94-07-13 REM Useful in making a ORACLE type date (13-JUL-94) if %mth%==01 set MTHC=JAN if %mth%==02 set MTHC=FEB if %mth%==03 set MTHC=MAR if %mth%==04 set MTHC=APR if %mth%==05 set MTHC=MAY if %mth%==06 set MTHC=JUN if %mth%==07 set MTHC=JUL if %mth%==08 set MTHC=AUG if %mth%==09 set MTHC=SEP if %mth%==10 set MTHC=OCT if %mth%==11 set MTHC=NOV if %mth%==12 set MTHC=DEC To increase environment space, if required, try shell=c:\command.com /p /e:877 in the CONFIG.SYS file and restart the computer. LY=Last year - 2 characters NY=Next year - 2 characters CENT=Century - 2 characters TH=Tens of hours - 1 character UH=Units of hours - 1 character TM=Tens of minutes - 1 character UM=Units of minutes - 1 character TS=Tens of seconds - 1 character US=Units of seconds - 1 character TDAY = Tens of days - 1 character UDAY = Units of days - 1 character TMTH = Tens of month - 1 character UMTH = Units of month - 1 character THU=Tens of hundredths of seconds - 1 character UHU=Units of hundredths of seconds - 1 character 12H=Hours (12 Hour time) - 2 characters CM=Character for Month - 1 character see below CD=Character for Day - 1 character see below Monday writes "m" when CD is in the list Tuesday writes "t" Wednesday writes "w" Thursday writes "h" Friday writes "f" Saturday writes "s" Sunday writes "u" January writes "j" when CM is in the list February writes "f" March writes "m" April writes "a" May writes "y" June writes "u" July writes "l" August writes "g" September writes "s" October writes "o" November writes "n" December writes "d" DFS - Days From Start of year - 3 characters DTE - Days To End of year - 3 characters WOM=Week Of Month - 1 digit (for such things as the 3rd Thursday in the month.) WOY=Week Of Year - 2 digits NM=Number of Minutes so far today - 4 digits P0-P9 - logical output (Y or N) depending on time of day for up to 10 periods MX=Month of year in hex. Useful if a single character is required for a month so that file extentions can be made up from %MX%%DAY% AD0-AD9 - with a following number, outputs a date representing the date which is that number of days away from the present date (+ or -). --------------------------------------------------------------------------- I have changed some code concerning Pn since version A as I can't get the concatenate function to work properly. I now just use substitution instead, here and for AD. Some of the numbers are limited to 32k, eg the number of days from the the system date that the program will work for. I might fix this next time. In the mean time, 87 years will have to do. In this version I have taken out the HALT when the system date is not at least as much as the compile date. This is to enable the program to generate a suitable date for an XT knowing the number of days from 1980-1-1. A message appears as a remark in the output if appropriate so as not to prevent batch file operation. What I am working on (obviously unfinished) now is: @echo off :incnum.bat Geoff Cutter 94-09-17 REM D: is a RAM drive d: copy incnum.bat c:\batch if not exist *.gcc goto explain dir *.gcc |find /i "GCC" >count.$$$ del *.gcc strings gcc= read count.$$$,1 strings gcc2= parse %gcc%,1, set gcc= strings gcc3= add %gcc2%,1 rem >%gcc3%.gcc echo AD5 %gcc3% =>c:\temp\setdate.doc type c:\util\setdate.doc >>c:\temp\setdate.doc c: cd\temp setdate goto end :explain echo This batch file takes a file name which is a number and echo increments it and saves it to the new value. Useful if echo you have an XT and wish to have an approx date (days echo from 80-01-01). Knowing the days, use SETDATE to find echo the date that number of days from there. If this is echo done once every day, the date will be correct on the XT. echo Use a variable such as AD5 in SETDATE to set up variables echo for setting the date. echo A file of the form NNNN.GCC should exist where NNNN is the number echo to be incremented. echo A file has been created for you for testing. Run %0 again. rem >8.gcc :end ---------------------------------------------------------------------------