home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / vrac / setdateb.zip / SETDATE.TXT < prev   
Text File  |  1994-09-18  |  10KB  |  291 lines

  1.  
  2. SETDATE.TXT               Version 1.B                           1994.09.18
  3. ───────────                                                     ──────────
  4.  
  5. sample data:
  6. YR MTH DAY HR MIN SEC HTH DOW DL TODAY DFS
  7. LY NY TDAY UDAY CM CD WOY NM
  8. P4 3 8 P5 720 880 AD5 1 AD3 -30      =
  9.  
  10. Those variables that the user wants to have in his environment are found
  11. before the first "=" sign at the start of this file. SETDATE.COM reads 
  12. this documentation file to determine which of the variables is required. 
  13. The set of possible variables is:
  14.  
  15. YR MTH DAY HR MIN SEC HTH DOW D3 DL TODAY TMTH UMTH DFS DTE WOM
  16. LY NY CENT TH UH TM UM TS US THU UHU 12H TDAY UDAY CM CD WOY NM MX
  17. P0, P1..P9  AD0, AD1..AD9
  18.  
  19. The P variables (period) are P0, P1 to P9 and are used as period indicators.
  20. If one of these is used, it must be followed by 2 numbers representing the 
  21. start and end of the period. if the numbers are both <= 24, the numbers are
  22. taken as hours, otherwise they are taken as minutes. If your data is 
  23. P4 12 14, you will get an output of SET P4=Y if the program is run between 
  24. 12:00 and 14:00 hrs, and SET P4=N otherwise. You can have a period extending 
  25. past midnight with numbers like 23 7.
  26.  
  27. Variables AD0, AD1..AD9 (Another Date) enable you to get the day, month and
  28. year of a date which is a given number of days from the present. AD3 1
  29. will give something similar to
  30.    SET AD3D=23
  31.    SET AD3M=08
  32.    SET AD3Y=94
  33. representing tomorrows date.
  34.  
  35. Previous dates are found by using negative numbers - the date 30 days 
  36. ago is given by using a negative value of 30 (AD8 -30).
  37.  
  38. Use of time and date environment variables:-
  39.  
  40. Having parts of the date and time in environment variables is handy when
  41. making backups, or otherwise naming files or directories according to date.
  42. The program SETDATE results in an output which may be redirected to make
  43. a batch file, which then is CALLed to create the nominated environment 
  44. variables as described below. You can change the behaviour of a batch
  45. file depending on the time of day by using the period variables.
  46.  
  47. SETDATE provides time variables down to hundredths of seconds and has a ready-
  48. made combination called TODAY which may be convenient.  The DOW (Day Of Week) 
  49. variable is available at 2 characters to enable a file name like 941205Tu.txt 
  50. to be made. A 3 character day and long version of day are available. Minutes 
  51. or seconds may be useful in doing intermediate backups of source code when 
  52. compiling via a batch file and can be used several times per day. Hundredths 
  53. may be useful in providing a random seed for games, display of screens or 
  54. other events. 
  55.  
  56. The program stops and warns if the system year is not at least 1994.
  57.  
  58. Ways to use SETDATE are shown in examples below.
  59.  
  60. If any of the variable names appear at the start of this file before "="
  61. and the program is run from the same directory as the documentation file 
  62. (or consider using the APPEND command), those variables will be written 
  63. out with the current data (so keep a standard list and just copy it to 
  64. the top and edit it there). Order and spacing do not matter, case does 
  65. (so you could include a lower case note in the list). 
  66.  
  67. Just run the program to see what your selection will bring. When 
  68. satisfactory, redirect it to a batch file and call it. If most names 
  69. are used, the output looks something like this:
  70.  
  71. SET TODAY=940515
  72. SET YR=94
  73. SET TMTH=0
  74. SET UMTH=5
  75. SET MTH=05
  76. SET MX=5
  77. SET THU=6
  78. SET UHU=0
  79. SET HTH=60
  80. SET TDAY=1
  81. SET UDAY=5
  82. SET NM=0803
  83. SET WOM=3
  84. SET DAY=15
  85. SET HR=13
  86. SET TH=1
  87. SET UH=3
  88. SET 12H=1
  89. SET MIN=23
  90. SET TM=2
  91. SET UM=3
  92. SET SEC=37
  93. SET TS=3
  94. SET US=7
  95. SET LY=1993
  96. SET NY=1995
  97. SET CENT=19
  98. SET DOW=Su
  99. SET D3=Sun
  100. SET DL=Sunday
  101. SET CD=u
  102. SET CM=y
  103. SET DFS=135
  104. SET WOY=20
  105. SET DTE=230
  106.  
  107. but you will probably want to be selective about what to include.
  108.  
  109. ---------------------------------------------------------------------------
  110. SETTODAY may called from the AUTOEXEC.BAT file but in addition, may be called
  111. from any other batch file or run separately.
  112.  
  113. This file, SETTODAY.BAT or something like it, is what is required to make 
  114. the variables (the directory \UTIL contains SETDATE.DOC and there is a 
  115. path to SETDATE.COM):
  116.  
  117.      :settoday.bat
  118.      rem change directory to where the data file is
  119.      cd\util
  120.      setdate >c:\setdate.bat
  121.      call c:\setdate
  122. ---------------------------------------------------------------------------
  123.  
  124. EXAMPLES:
  125. ─────────
  126. :File: ec.bat
  127. rem Edit the file of data captured from the bulletin board, then rename.
  128. ed caught.txt/e
  129. ren caught.txt %yr%%mth%%day%%min%.txt
  130.  
  131.  
  132. :File: nl.bat
  133. :new letter
  134. rem A 2 character command line parameter is allowed to enable the creation 
  135. rem of lots of letters every day. The $ in the directory name makes it sort
  136. rem to the top of the tree.
  137. ed c:\$geoff\%yr%%mth%%day%%1.txt 
  138.  
  139.  
  140. :dt.bat          G.Cutter        93.11.08
  141. :done today
  142. :(for Australia - order the variables to suit your country)
  143. dir /on |find "%day%-%mth%-%yr%"
  144.  
  145.  
  146. @echo off
  147. :test.bat                  G.Cutter                     93.01.10
  148. :                                           Data was P8   15 19
  149. rem "Display the file if in period 8"
  150. if .%P8%==.Y goto showit
  151. goto missit
  152. :showit
  153. type c:\config.sys
  154. pause
  155. :missit
  156.  
  157. @echo off
  158. :setmthc.bat          Geoff Cutter           94-07-13
  159. REM Useful in making a ORACLE type date (13-JUL-94)
  160. if %mth%==01 set MTHC=JAN
  161. if %mth%==02 set MTHC=FEB
  162. if %mth%==03 set MTHC=MAR
  163. if %mth%==04 set MTHC=APR
  164. if %mth%==05 set MTHC=MAY
  165. if %mth%==06 set MTHC=JUN
  166. if %mth%==07 set MTHC=JUL
  167. if %mth%==08 set MTHC=AUG
  168. if %mth%==09 set MTHC=SEP
  169. if %mth%==10 set MTHC=OCT
  170. if %mth%==11 set MTHC=NOV
  171. if %mth%==12 set MTHC=DEC
  172.  
  173.  
  174. To increase environment space, if required, try
  175.      shell=c:\command.com /p /e:877
  176. in the CONFIG.SYS file and restart the computer.
  177.  
  178.        LY=Last year -          2 characters
  179.        NY=Next year -          2 characters
  180.        CENT=Century -          2 characters
  181.        TH=Tens of hours -      1 character
  182.        UH=Units of hours -     1 character
  183.        TM=Tens of minutes -    1 character
  184.        UM=Units of minutes -   1 character
  185.        TS=Tens of seconds -    1 character
  186.        US=Units of seconds -   1 character
  187.        TDAY = Tens of days -   1 character
  188.        UDAY = Units of days  - 1 character
  189.        TMTH = Tens of month  - 1 character
  190.        UMTH = Units of month - 1 character
  191.        THU=Tens of hundredths of seconds - 1 character
  192.        UHU=Units of hundredths of seconds - 1 character
  193.        12H=Hours (12 Hour time) - 2 characters
  194.        CM=Character for Month - 1 character       see below
  195.        CD=Character for Day   - 1 character       see below
  196.  
  197.        Monday     writes "m"      when CD is in the list
  198.        Tuesday    writes "t"
  199.        Wednesday  writes "w"
  200.        Thursday   writes "h"
  201.        Friday     writes "f"
  202.        Saturday   writes "s"
  203.        Sunday     writes "u"
  204.  
  205.        January    writes "j"      when CM is in the list
  206.        February   writes "f"   
  207.        March      writes "m"   
  208.        April      writes "a"
  209.        May        writes "y"
  210.        June       writes "u"
  211.        July       writes "l"
  212.        August     writes "g"
  213.        September  writes "s"
  214.        October    writes "o"
  215.        November   writes "n"
  216.        December   writes "d" 
  217.  
  218.        DFS    -  Days From Start of year  - 3 characters
  219.        DTE    -  Days To End of year      - 3 characters
  220.  
  221.        WOM=Week Of Month - 1 digit (for such things as the 3rd 
  222.        Thursday in the month.)
  223.  
  224.        WOY=Week Of Year - 2 digits
  225.  
  226.        NM=Number of Minutes so far today - 4 digits
  227.  
  228.        P0-P9 - logical output (Y or N) depending on time of day for 
  229.        up to 10 periods
  230.  
  231.        MX=Month of year in hex. Useful if a single character is required 
  232.        for a month so that file extentions can be made up from %MX%%DAY%
  233.  
  234.        AD0-AD9 - with a following number, outputs a date representing the 
  235.        date which is that number of days away from the present date (+ or -).
  236. ---------------------------------------------------------------------------
  237. I have changed some code concerning Pn since version A as I can't get the 
  238. concatenate function to work properly. I now just use substitution instead,
  239. here and for AD.
  240.  
  241. Some of the numbers are limited to 32k, eg the number of days from the
  242. the system date that the program will work for. I might fix this next time.
  243. In the mean time, 87 years will have to do.
  244.  
  245. In this version I have taken out the HALT when the system date is not
  246. at least as much as the compile date. This is to enable the program to 
  247. generate a suitable date for an XT knowing the number of days from 1980-1-1.
  248. A message appears as a remark in the output if appropriate so as not to 
  249. prevent batch file operation.
  250.  
  251. What I am working on (obviously unfinished) now is:
  252.  
  253. @echo off
  254. :incnum.bat                   Geoff Cutter             94-09-17
  255. REM D: is a RAM drive
  256. d:
  257. copy incnum.bat c:\batch
  258. if not exist *.gcc goto explain
  259. dir *.gcc |find /i "GCC" >count.$$$
  260. del *.gcc
  261. strings gcc= read count.$$$,1
  262. strings gcc2= parse %gcc%,1,
  263. set gcc=
  264. strings gcc3= add %gcc2%,1
  265. rem >%gcc3%.gcc
  266. echo AD5 %gcc3% =>c:\temp\setdate.doc
  267. type c:\util\setdate.doc >>c:\temp\setdate.doc
  268. c:
  269. cd\temp
  270. setdate
  271.  
  272. goto end
  273.  
  274. :explain
  275. echo  This batch file takes a file name which is a number and 
  276. echo  increments it and saves it to the new value. Useful if 
  277. echo  you have an XT and wish to have an approx date (days 
  278. echo  from 80-01-01). Knowing the days, use SETDATE to find
  279. echo  the date that number of days from there. If this is 
  280. echo  done once every day, the date will be correct on the XT.
  281. echo  Use a variable such as AD5 in SETDATE to set up variables
  282. echo  for setting the date.
  283.  
  284. echo A file of the form NNNN.GCC should exist where NNNN is the number
  285. echo to be incremented.
  286. echo A file has been created for you for testing. Run %0 again.
  287. rem >8.gcc
  288. :end
  289.  
  290. ---------------------------------------------------------------------------
  291.