home *** CD-ROM | disk | FTP | other *** search
-
-
- Program: udate
- Programmer: George Kerber
- Written: 12/17/89 - 05/28/90
- Compiler: Turbo "C"
- Application: MS-DOS
- Version: 1.21p
- History: Converted to MS-DOS from the AmigaDOS 'udate' & 'dst' programs.
-
- Purpose: Displays the date and/or time in any format, including the
- current timezone.
-
- Closely emulates the UNIX date command for date string
- formatting. Supports all of the UNIX format characters and
- adds others.
-
- Automatically adjusts the clock for daylight savings time.
-
- Sets the date and time.
- (replacing the MS-DOS 'date' & 'time' command)
-
-
- SYNTAX: udate [[?][hh:mm|mm/dd/yy][-help][-dst|-DST][["format string"][NOLINE]]]
-
- udate Displays the date & time in the default format.
- (the default is user configurable, see below)
- udate ? Displays a help screen.
- udate hh:mm Sets the computer time.
- udate mm/dd[/yy] Sets the computer date.
- udate -help Displays a help screen for setting the TIMEZONE,
- ESCAPE & DEFAULT variables.
- udate -dst|-DST Automatically adjusts the system clock for daylight
- savings time.
- udate ... NOLINE A newline is not automatically output.
-
-
- If udate is executed with no options the date and time will be displayed in
- the default format. If the 'timezone' variable is set (see below), then the
- current timezone is also displayed. The default format is:
-
- ddddd dd-mmm-yy hh:mm tzn
-
- (see below for directions on changing the 'default' date string)
-
-
- A formatted string can be given as an option to display the date and/or time
- exactly as desired. If any spaces are to be included in the format string,
- the entire format string must be quoted. Literal spaces and characters can
- be included in the format string. See the examples below.
- By default the escape character is a backslash (\), but can be changed. See
- below for directions. The format characters are described below.
-
- \a abbreviated weekday name
- \A full weekday name
- \b abbreviated month name
- \B full month name
- \d day of month - 01 to 31
- \e day of month - 1 to 31 (with leading space, if < 10)
- \I hour - 01 to 12
- \i hour - 1 to 12 (not available in UNIX)
- \H hour - 00 to 23
- \m month of year - 01 to 12
- \n insert a new-line character
- \t insert a tab character
- \r time as hh:mm:ss pp (AM/PM)
- \T time as hh:mm:ss
- \R time as hh:mm
- \S second - 00 to 59
- \j julian day of year
- \J days remaining in year (not available in UNIX)
- \y two digit year
- \Y four digit year
- \D date as mm/dd/yy
- \x day of month extension (th, st, nd or rd)
- \M minute - 00 to 59
- \p string, "AM" or "PM"
- \w day of week - Sunday = 0
- \W day of week - Sunday = 1 (not available in UNIX)
- \u date/time display in UNIX default format
- ddd mmm dd hh:mm:ss tzn* yyyy
- \Z timezone*
- \g date/time display, greeting format (not available in UNIX)
- \1 Textcolor lightblue.
- \2 Textcolor lightgreen.
- \3 Textcolor lightcyan.
- \4 Textcolor lightred.
- \5 Textcolor lightmagenta.
- \6 Textcolor yellow.
- \8 Textcolor white (bold)
- \9 Restores text color to the system default.
- \$ displays the date/time in the default format.
- ddddd dd-mmm-yy hh:mm tzn
- This 'default' display IS NOT changed by changing the DEFAULT
- variable as described below.
-
-
- \" Prints a literal quote in the format string.
-
- Enter the 'escape' character twice with no space to print a
- literal 'escape' character.
-
- * Timezone will be displayed if set as described below. No errors
- are shown if the timezone variable is not set.
-
-
- Examples: udate /* default */
- Mon 18-Dec-89 09:51 MST
-
- udate 9:51 /* set the time */
- Date: December 18, 1989 New Time: 09:51
-
- udate 12/18 /* set the date */
- New Date: December 18, 1989 Time: 09:51
-
- udate "Today is \A \B \d\x, \Y"
- Today is Monday December 18th, 1989
-
- udate \g /* this is good for your autoexec.bat file */
- Good Morning! Today is Monday, December 18th at 9:53 AM (MST)
-
- udate "\n\o George,\n\n\k\n" /* or this */
-
- Good Morning George,
-
- Today is Monday, December 18th at 9:53 AM (MST)
-
-
- udate "Date/Time display in UNIX format\n\u"
- Date/Time display in UNIX format
- Mon Dec 18 09:54:21 MST 1989
-
-
-
- SETTING THE DATE & TIME:
-
- If udate is executed with a string that resembles a date or time, then
- udate will attempt to change the computer clock to the new date or time.
- The system clock will always be changed, but the battery backup clock may
- or may not be changed. See your computer documentation for more
- information about the battery backup clock.
-
- Change Time: udate hh:mm
-
- The seconds are automatically set to 00 each time the time
- is changed.
-
- Change Date: udate mm/dd[/yy]
-
- The year is optional, if no year is entered, then the
- current year will be retained.
-
- NOTE: The 'udate' program can be used as an 'echo' command if desired.
- Because of how 'udate' determines if the user is trying to
- change the date or time, you can't simply 'echo' a constant date
- or time using udate. For example, if you enter:
-
- udate 12/23/89
-
- udate will change the date to 12/23/89, rather than 'echo' 12/23/89
- to the screen. You could enter:
-
- udate "12/23/89 "
-
- to actually 'echo' 12/23/89 to the screen. Notice the extra literal
- space at the end, this 'tricks' udate into thinking that you are
- not entering a valid date.
-
- Or you could use the MS-DOS 'echo' command to do the same thing, which
- would be slightly quicker since 'echo' is a built-in command.
-
-
- SETTING THE TIMEZONE VARIABLE:
-
- Add the following line to your autoexec.bat file: (if desired)
-
- set TIMEZONE=tzn[:dst]
-
- where 'tzn' = the current standard timezone for your area.
- (EST, CST, MST, PST, etc) All three characters must be used.
-
- where 'dst' = the optional timezone for your area when daylight savings time
- is in-effect. (EDT, CDT, MDT, PDT, etc) If your area does not observe
- daylight savings time, then only enter 'tzn' as described above.
- If 'dst' is used, you must use all three characters and use an ':' as
- a field separator.
-
- Examples: set TIMEZONE=EST:EDT
- set TIMEZONE=MST:MDT
- set TIMEZONE=PST
-
- The TIMEZONE variable must be set exactly as shown or 'udate' will
- completely ignore it. Setting the TIMEZONE is optional, but the current
- timezone will not be displayed if it isn't set.
-
-
- CHANGING ESCAPE CHARACTER DEFAULT: (if desired)
-
- By default the 'escape' character for the format string is a backslash (\).
- This can be changed by the user to conform to MS-DOS 'standard' or anything
- else for user preference. For example to set the 'escape' character to
- a '%' add the following line to your autoexec.bat file:
-
- set ESCAPE=%
-
- (a '%' is the standard UNIX escape character for the 'date' command)
-
- Now the format string will require a '%s instead of a '\' when using the
- format characters. This is the line to change the 'escape' character
- to a forward slash (or modifier in MS-DOS format):
-
- set ESCAPE=/
-
- If the ESCAPE variable is set to more than one character, only the first
- character will be used. Changing the default escape character is optional,
- and is normally not necessary unless you 'despise' using backslashes for this
- purpose.
-
-
- CHANGING THE DEFAULT DATE STRING: (if desired)
-
- By default the date and time is presented to the user is:
-
- ddddd dd-mmm-yy hh:mm tzn
-
- when no options are given. This can be changed by the user by setting
- the 'DEFAULT' variable. The DEFAULT variable should contain a string
- containing text and/or format characters as would be entered as options
- to udate to produce the formatted string. For example, to change the
- 'default' date/time string to:
-
- UNIX format date is ddd mmm dd hh:mm:ss tzn* yyyy
-
- add this line to your autoexec.bat file:
-
- set DEFAULT=UNIX format date is \u
-
- The DEFAULT date string must contain the correct 'escape' character. The
- default 'escape' character is a backslash, but can be changed as described
- above. Changing the 'default' default datestring is optional and should
- only be done is you desire a different 'default' date/time string.
-
- The original 'default' date string can always be displayed by using
- the '$' format character.
-
-
- AUTOMATIC DAYLIGHT SAVINGS TIME ADJUSTMENT
-
- udate will automatically keep your clock set for the correct time while
- daylight savings time is in effect and while it's not. There are two
- options to use depending on how your PC handles the battery clock.
-
- If the battery clock of your PC is changed by using the MS-DOS date and time
- command, then use -DST. If your PC requires a special command to write the
- system clock time to the battery clock then use -dst. If you use the -DST
- command, a file named 'udate.dst' will be written to the root directory of
- your c: drive during daylight savings time. Do not delete this file!
-
- Example: Add one of these lines to your autoexec.bat file
-
- udate -dst --Used if the MS-DOS date/time commands only change the
- system clock, but leave the battery clock unchanged.
- udate -DST --Used if the MS-DOS date/time commands change both the
- system clock and the battery clock.
-
- Set your battery clock to standard time in your area and add one of the
- above lines to your autoexec.bat file. If a command is necessary in the
- autoexec.bat file to read the battery clock, the 'udate -dst' line must
- follow the readclock command.
-
- The 'udate -dst' command should only be executed once per login session. The
- 'udate -DST command (if used) can be executed many times, but there is no
- reason to do so.
-
- If setup properly, you will NEVER have to do the twice yearly ritual of
- resetting your computer clock for daylight savings time.
-
- If the time ever seems to be screwed up, delete the udate.dst file if it
- exists in the root directory of c:, set your clock to standard time and
- reboot. Note that the 'c:\udate.dst' file is "hidden" and cannot
- be seen with the MS-DOS dir command.
-
-
- BUGS
-
- The program can become confused if it is executed twice using one of the
- daylight savings time options between 2 and 3 am on the day that daylight
- savings time is over. (late October) This seems like a minor bug
- and shouldn't show up very often since it can only occur if the
- computer is booted in the early hours of the morning on the change over
- date and then rebooted before the hour is up.
-
-
- UNIX?
-
- This program includes all of the UNIX date command format characters.
- The format string is a little different. The UNIX date command uses a '%'
- as an escape character for the format characters. I know why the UNIX
- command uses the '%' but MS-DOS and AmigaDOS has no need, so I chose to use
- a backslash '\' instead. Also the UNIX date command requires that all
- format strings begin with a '+'. Again I saw no need, so I didn't require
- it. The default date string for 'udate' is different than the UNIX version,
- but I added a format character '\u' to display the date in the UNIX default
- format. The 'udate' command follows 'standard' UNIX convention for
- options instead of the MS-DOS convention. If desired, the udate
- command can be configured for UNIX or MS-DOS 'standards' as described
- above by setting the DEFAULT and ESCAPE variables.
-
-
- PROGRAM HISTORY
-
- This program is actually a 'hacked' combination of my 'udate' and 'dst'
- programs that I wrote in Lattice "C" for the Commodore Amiga computer.
-
-
- PUBLIC DOMAIN
-
- This program is released to the public domain. Please feel free to use and
- distribute this program. I do insist that the udate.exe and udate.doc
- files are distributed together and that I am kept as the author.
- I'm not responsible for any problems with this program or problems that
- may be attributed to it. (I hate responsibility).
-
-
-
- George Kerber
- 19756 E. Linvale Drive
- Aurora, CO 80013
- 303-693-2890
-