• Publicity: Public Only All

acs-datetime-procs.tcl

Tcl library for the ACS Date-Time service package

Location:
packages/acs-datetime/tcl/acs-datetime-procs.tcl
Created:
2000-11-21
Author:
ron@arsdigita.com
CVS Identification:
$Id: acs-datetime-procs.tcl,v 1.19.2.8 2023/03/23 16:14:43 antoniop Exp $

Procedures in this file

Detailed information

dt_ansi_to_julian (public)

 dt_ansi_to_julian year month day [ era ]
Parameters:
year (required)
month (required)
day (required)
era (optional)
this argument is obsolete and passing it to the proc will generate a warning.
Returns:
the ANSI date as Julian or -1 in the case of an invalid ANSI date argument (year less than 4713 BCE, greater than 9999 CE, or equal to 0)

Testcases:
dt_ansi_to_julian

dt_ansi_to_julian_single_arg (public)

 dt_ansi_to_julian_single_arg ansi [ era ]

Splits the ANSI date into year, month and day, and calls dt_ansi_to_julian to transform it to Julian.

Parameters:
ansi (required)
era (optional)
Returns:
the ANSI date as Julian
See Also:

Testcases:
dt_ansi_to_julian_single_arg

dt_ansi_to_list (public)

 dt_ansi_to_list [ ansi_date ]

Parses the given ansi_date string into a list of year, month, day, hour, minute, and second. Works for any date than can be parsed by clock scan.

Parameters:
ansi_date (optional)

Testcases:
dt_ansi_to_list

dt_ansi_to_pretty (public)

 dt_ansi_to_pretty [ ansi_date ]

Converts an ANSI date into a localzed one. With no argument, it returns the current date based on server time. Works for both date and date-time strings.

Parameters:
ansi_date (optional)
Date in ANSI format (for example, 1998-09-05)
Returns:
Localized date (for example, on 'en_US', 05/09/98)

Testcases:
dt_localized_procs

dt_first_day_of_month (public)

 dt_first_day_of_month year month
Parameters:
year (required)
month (required)
Returns:
the weekday number of the first day for the given month/year

Testcases:
dt_first_day_of_month

dt_format (public, deprecated)

 dt_format [ -format format ] [ -gmt gmt ] time
Deprecated. Invoking this procedure generates a warning.

This proc should not be used, because it does not take internationalization into account. Use lc_time_fmt instead.

Switches:
-format (optional, defaults to "%Y-%m-%d %H:%M:%S")
-gmt (optional, defaults to "f")
Parameters:
time (required)
See Also:

Testcases:
No testcase defined.

dt_interval_check (public)

 dt_interval_check start end

Checks the values of start and end to see if they form a valid time interval. Returns: > 0 if end > start 0 if end = start < 0 if end < start Input variables can be any strings that can be converted to times using clock scan.

Parameters:
start (required)
end (required)

Testcases:
dt_interval_check

dt_julian_to_ansi (public)

 dt_julian_to_ansi julian_date
Parameters:
julian_date (required)
Returns:
julian_date formatted as "yyyy-mm-dd"

Testcases:
dt_julian_to_ansi

dt_month_abbrev (public)

 dt_month_abbrev
Returns:
the calendar month names as a Tcl list (Jan, Feb, ...)
See Also:

Testcases:
dt_localized_procs

dt_month_names (public)

 dt_month_names
Returns:
the calendar month names as a Tcl list (January, February, ...)
See Also:

Testcases:
dt_localized_procs

dt_next_month (public)

 dt_next_month year month
Parameters:
year (required)
month (required)
Returns:
the ANSI date for the next month

Testcases:
dt_prev_next_month

dt_next_month_name (public)

 dt_next_month_name year month
Parameters:
year (required)
month (required)
Returns:
Localized name of the next month

Testcases:
dt_localized_procs

dt_num_days_in_month (public)

 dt_num_days_in_month year month
Parameters:
year (required)
month (required)
Returns:
the numbers of days for the given month/year

Testcases:
dt_num_days_in_month

dt_prev_month (public)

 dt_prev_month year month
Parameters:
year (required)
month (required)
Returns:
the ANSI date for the previous month

Testcases:
dt_prev_next_month

dt_prev_month_name (public)

 dt_prev_month_name year month
Parameters:
year (required)
month (required)
Returns:
Localized name of the previous month

Testcases:
dt_localized_procs

dt_sysdate (public)

 dt_sysdate [ -format format ]
Switches:
-format (optional, defaults to "%Y-%m-%d")
Returns:
current server date in the standard format "yyyy-mm-dd"

Testcases:
dt_sysdate_systime

dt_systime (public)

 dt_systime [ -format format ] [ -gmt gmt ]
Switches:
-format (optional, defaults to "%Y-%m-%d %H:%M:%S")
-gmt (optional, defaults to "f")
returns the time in GMT.
Returns:
current server time in the standard format "yyyy-mm-dd hh:mi:ss".

Testcases:
dt_sysdate_systime

dt_valid_time_p (public)

 dt_valid_time_p time
Parameters:
time (required)
Returns:
1 if "time" is a valid time specification, 0 otherwise.

Testcases:
dt_valid_time_p, dt_sysdate_systime

dt_widget_datetime (public, deprecated)

 dt_widget_datetime [ -show_date show_date ] \
    [ -date_time_sep date_time_sep ] [ -use_am_pm use_am_pm ] \
    [ -default default ] name [ granularity ]
Deprecated. Invoking this procedure generates a warning.

Switches:
-show_date (optional, defaults to "1")
-date_time_sep (optional, defaults to "&nbsp;")
-use_am_pm (optional, defaults to "0")
-default (optional, defaults to "none")
Parameters:
name (required)
granularity (optional, defaults to "days")
Returns:
an HTML form fragment for collecting date-time information with names "$name.year", "$name.month", "$name.day", "$name.hours", "$name.minutes", "$name.seconds", and "$name.ampm". These will be numeric ("ampm" is 0 for am, 1 for pm) Default specifies what should be set as the current time in the form. Valid defaults are "none", "now", or any valid date string that can be converted with clock scan. Granularity can be "months" "days" "hours" "halves" "quarters" "fives" "minutes" or "seconds". Use -show_date 0 for a time entry widget (no dates). All HTML widgets will be output *unless* show_date is 0; they will be hidden if not needed to satisfy the current granularity level. Values default to 1 for MM/DD and 0 for HH/MI/SS/AM if not found in the input string or if below the granularity threshold. DEPRECATED: modern HTML5 feature make this widget less relevant. It is also cumbersome to style and localize.
See Also:

Testcases:
No testcase defined.

dt_widget_maybe_range (public, deprecated)

 dt_widget_maybe_range [ -hide hide ] [ -hidden_value hidden_value ] \
    [ -default default ] [ -format format ] ask_for_value name start \
    end default_value [ interval ] [ with_leading_zeros ] \
    [ hidden_value ]
Deprecated. Invoking this procedure generates a warning.

DEPRECATED: this proc was only used inside of now deprecated dt_widget_datetime.

Switches:
-hide (optional, defaults to "t")
-hidden_value (optional, defaults to "00")
-default (optional)
-format (optional, defaults to "%02d")
Parameters:
ask_for_value (required)
name (required)
start (required)
end (required)
default_value (required)
interval (optional, defaults to "1")
with_leading_zeros (optional, defaults to "0")
hidden_value (optional, defaults to "00")
Returns:
form numeric range, or hidden_value if ask_for_value is false.
See Also:

Testcases:
No testcase defined.

dt_widget_month_names (public, deprecated)

 dt_widget_month_names name [ selected_month ]
Deprecated. Invoking this procedure generates a warning.

DEPRECATED: modern HTML5 feature make this widget less relevant. It is also cumbersome to style and localize.

Parameters:
name (required)
selected_month (optional, defaults to "0")
Returns:
a select widget for months of the year.
See Also:

Testcases:
No testcase defined.

dt_widget_numeric_range (public, deprecated)

 dt_widget_numeric_range name begin end [ default ] [ interval ] \
    [ with_leading_zeros ]
Deprecated. Invoking this procedure generates a warning.

DEPRECATED: this widget would be difficult to style and is actually simpler to inline such an idiom in one's tcl or adp code. The templating system also provides select widgets that take care of validating the selection.

Parameters:
name (required)
begin (required)
end (required)
default (optional)
interval (optional, defaults to "1")
with_leading_zeros (optional, defaults to "0")
Returns:
an HTML select widget for a numeric range
See Also:

Testcases:
No testcase defined.
[ show source ]