Date Package for TCL

Current Version: 2.9 (for TCL 8.0.x)
Current Version: 2.14 (for TCL 8.2.x)
Current Version: 2.16 (for TCL 8.3.x, 8.4.x)
Author: Evan Rempel erempel@UVic.CA

Date::SetFormat DateFormat
SetFormat must be called before any other date routines are used. Setformat may be called again to change the format that you wish to operate in.

The DateFormat may be any combination of characters that include

Date::SetFormat "MMM, DD/YYYY T12m"

Date::GetFormat

Return the string used to set the current date format. This is usefull to save the current date format, temporarily set a new date format and finally set the format back to the original.

Date::Compare Date1 Date2

Compare the date and time according to the DateFormat returning

Date1 < Date2 return -1
Date1 = Date2 return 0
Date1 > Date2 return 1

Date::Adjust Date Adjustment

Return a new Date that is advanced or retreated by the adjustment specified. Adjustments can be any combination of years, months, weeks days, hours, minutes or seconds with an optional modifier of "ago" to indicate in the past.

The adjustment may also be the full day of the week (Thursday) to return the same time on the specified day of the week that Date falls in. Sunday is the first day of the week.

Date::Today ?relative?

Return the current date from the operating system with the time specified by relative.

Date::Now

Return the current date and time from the operating system

Date::WeekDay Date ?S|L|N?

Return the current day of the week in either short, long or numeric form. The default is short.

Date::Day Date ?S|L?

Return the current day of the month in either short (no leading zero) or long (always two digits). The default is short.

Date::Month Date ?S|L|N?

Return the current month of the year in either short, long or numeric form. The default is short.

Date::Year Date ?L|S?

Return the year in either long (4 digit), or short (2 digit) format. The default is long.

Date::Hour Date ?S|L?

Return the hour in either long (2 digit), or short (no leading zero) format. The default is short.

Date::Minute Date ?S|L?

Return the minute in either long (2 digit), or short (no leading zero) format. The default is short.

Date::Second Date ?S|L?

Return the second in either long (2 digit), or short (no leading zero) format. The default is short.

Date::Convert Date Format

Convert the date specified in the format set with SetFormat to the format specified in Format. See SetFormat for the options of Format.

Date::Apart Date1 Date2

Return a string specifying the number of days, hours, minutes and seconds from Date1 to Date2. This information is in a format ready for the Adjust routine.

Date::Seconds DateApart

Return the number of seconds equivilent to the contents of the string DateApart. DateAppart must be in the format returned by the Apart routine. This is included so that you can set timers using the TCL after command based on date differences.

Date::Parse DateString

Interpret the format free date DateString and return a string date of the format specified with SetFormat.

Date::Test ?detail?

Test the most critical date routines. Returns 0 if no errors encountered, otherwise return 1. If "detail" is included, display the results of the tests as they are made.


Revision History

Version 2.16 - Jan 4, 2001
Version 2.15 - Jun 5, 2000
Version 2.14 - Mar 13, 2000
Version 2.13 - Mar 11, 2000
Version 2.12 - Jan 25, 2000
Version 2.11 - Oct 29, 1999
Version 2.10 - July 18, 1999
Version 2.9 - July 5, 1999
Version 2.8 - May 9, 1999
Version 2.7 - April 20, 1999
Version 2.6 - April 14, 1999
Version 2.5 - March 23, 1999.