• 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
month
day
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)

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_ansi_to_julian dt_ansi_to_julian (test acs-datetime) dt_ansi_to_julian dt_ansi_to_julian test_dt_ansi_to_julian->dt_ansi_to_julian ad_log ad_log (public) dt_ansi_to_julian->ad_log dt_ansi_to_julian_single_arg dt_ansi_to_julian_single_arg (public) dt_ansi_to_julian_single_arg->dt_ansi_to_julian dt_get_info dt_get_info (public) dt_get_info->dt_ansi_to_julian dt_widget_month dt_widget_month (public, deprecated) dt_widget_month->dt_ansi_to_julian packages/calendar/www/view-list-display.tcl packages/calendar/ www/view-list-display.tcl packages/calendar/www/view-list-display.tcl->dt_ansi_to_julian packages/calendar/www/view-month-display.tcl packages/calendar/ www/view-month-display.tcl packages/calendar/www/view-month-display.tcl->dt_ansi_to_julian

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
era (optional)
Returns:
the ANSI date as Julian
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_ansi_to_julian_single_arg dt_ansi_to_julian_single_arg (test acs-datetime) dt_ansi_to_julian_single_arg dt_ansi_to_julian_single_arg test_dt_ansi_to_julian_single_arg->dt_ansi_to_julian_single_arg dt_ansi_to_julian dt_ansi_to_julian (public) dt_ansi_to_julian_single_arg->dt_ansi_to_julian dt_ansi_to_list dt_ansi_to_list (public) dt_ansi_to_julian_single_arg->dt_ansi_to_list util::trim_leading_zeros util::trim_leading_zeros (public) dt_ansi_to_julian_single_arg->util::trim_leading_zeros packages/calendar/www/view-month-display.tcl packages/calendar/ www/view-month-display.tcl packages/calendar/www/view-month-display.tcl->dt_ansi_to_julian_single_arg

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)

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_ansi_to_list dt_ansi_to_list (test acs-datetime) dt_ansi_to_list dt_ansi_to_list test_dt_ansi_to_list->dt_ansi_to_list dt_systime dt_systime (public) dt_ansi_to_list->dt_systime util::trim_leading_zeros util::trim_leading_zeros (public) dt_ansi_to_list->util::trim_leading_zeros dt_ansi_to_julian_single_arg dt_ansi_to_julian_single_arg (public) dt_ansi_to_julian_single_arg->dt_ansi_to_list dt_get_info dt_get_info (public) dt_get_info->dt_ansi_to_list dt_widget_datetime dt_widget_datetime (public, deprecated) dt_widget_datetime->dt_ansi_to_list dt_widget_month dt_widget_month (public, deprecated) dt_widget_month->dt_ansi_to_list packages/calendar/www/mini-calendar.tcl packages/calendar/ www/mini-calendar.tcl packages/calendar/www/mini-calendar.tcl->dt_ansi_to_list

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)

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_localized_procs dt_localized_procs (test acs-datetime) dt_ansi_to_pretty dt_ansi_to_pretty test_dt_localized_procs->dt_ansi_to_pretty dt_sysdate dt_sysdate (public) dt_ansi_to_pretty->dt_sysdate lc_time_fmt lc_time_fmt (public) dt_ansi_to_pretty->lc_time_fmt dt_widget_calendar_navigation dt_widget_calendar_navigation (public, deprecated) dt_widget_calendar_navigation->dt_ansi_to_pretty

Testcases:
dt_localized_procs

dt_first_day_of_month (public)

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

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_first_day_of_month dt_first_day_of_month (test acs-datetime) dt_first_day_of_month dt_first_day_of_month test_dt_first_day_of_month->dt_first_day_of_month dt_get_info dt_get_info (public) dt_get_info->dt_first_day_of_month packages/calendar/www/mini-calendar.tcl packages/calendar/ www/mini-calendar.tcl packages/calendar/www/mini-calendar.tcl->dt_first_day_of_month packages/calendar/www/view-month-display.tcl packages/calendar/ www/view-month-display.tcl packages/calendar/www/view-month-display.tcl->dt_first_day_of_month packages/xowiki/lib/portlets/weblog-mini-calendar.tcl packages/xowiki/ lib/portlets/weblog-mini-calendar.tcl packages/xowiki/lib/portlets/weblog-mini-calendar.tcl->dt_first_day_of_month

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
(defaults to "%Y-%m-%d %H:%M:%S") (optional)
-gmt
(defaults to "f") (optional)
Parameters:
time
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 ad_log_deprecated ad_log_deprecated (public) dt_format dt_format dt_format->ad_log_deprecated

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
end

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_interval_check dt_interval_check (test acs-datetime) dt_interval_check dt_interval_check test_dt_interval_check->dt_interval_check packages/news/www/admin/approve-2.tcl packages/news/ www/admin/approve-2.tcl packages/news/www/admin/approve-2.tcl->dt_interval_check packages/news/www/preview.tcl packages/news/ www/preview.tcl packages/news/www/preview.tcl->dt_interval_check

Testcases:
dt_interval_check

dt_julian_to_ansi (public)

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

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_julian_to_ansi dt_julian_to_ansi (test acs-datetime) dt_julian_to_ansi dt_julian_to_ansi test_dt_julian_to_ansi->dt_julian_to_ansi calendar::adjust_date calendar::adjust_date (public, deprecated) calendar::adjust_date->dt_julian_to_ansi dt_widget_calendar_navigation dt_widget_calendar_navigation (public, deprecated) dt_widget_calendar_navigation->dt_julian_to_ansi packages/calendar/www/cal-item-new.tcl packages/calendar/ www/cal-item-new.tcl packages/calendar/www/cal-item-new.tcl->dt_julian_to_ansi packages/calendar/www/mini-calendar.tcl packages/calendar/ www/mini-calendar.tcl packages/calendar/www/mini-calendar.tcl->dt_julian_to_ansi packages/calendar/www/view-month-display.tcl packages/calendar/ www/view-month-display.tcl packages/calendar/www/view-month-display.tcl->dt_julian_to_ansi

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:

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_localized_procs dt_localized_procs (test acs-datetime) dt_month_abbrev dt_month_abbrev test_dt_localized_procs->dt_month_abbrev lc_get lc_get (public) dt_month_abbrev->lc_get

Testcases:
dt_localized_procs

dt_month_names (public)

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

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_localized_procs dt_localized_procs (test acs-datetime) dt_month_names dt_month_names test_dt_localized_procs->dt_month_names lc_get lc_get (public) dt_month_names->lc_get dt_widget_calendar_navigation dt_widget_calendar_navigation (public, deprecated) dt_widget_calendar_navigation->dt_month_names dt_widget_month_names dt_widget_month_names (public, deprecated) dt_widget_month_names->dt_month_names packages/calendar/www/mini-calendar.tcl packages/calendar/ www/mini-calendar.tcl packages/calendar/www/mini-calendar.tcl->dt_month_names packages/calendar/www/view-month-display.tcl packages/calendar/ www/view-month-display.tcl packages/calendar/www/view-month-display.tcl->dt_month_names packages/xowiki/lib/portlets/weblog-mini-calendar.tcl packages/xowiki/ lib/portlets/weblog-mini-calendar.tcl packages/xowiki/lib/portlets/weblog-mini-calendar.tcl->dt_month_names

Testcases:
dt_localized_procs

dt_next_month (public)

 dt_next_month year month
Parameters:
year
month
Returns:
the ANSI date for the next month

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_prev_next_month dt_prev_next_month (test acs-datetime) dt_next_month dt_next_month test_dt_prev_next_month->dt_next_month ad_log ad_log (public) dt_next_month->ad_log dt_get_info dt_get_info (public) dt_get_info->dt_next_month

Testcases:
dt_prev_next_month

dt_next_month_name (public)

 dt_next_month_name year month
Parameters:
year
month
Returns:
Localized name of the next month

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_localized_procs dt_localized_procs (test acs-datetime) dt_next_month_name dt_next_month_name test_dt_localized_procs->dt_next_month_name ad_log ad_log (public) dt_next_month_name->ad_log lc_clock_to_ansi lc_clock_to_ansi (public) dt_next_month_name->lc_clock_to_ansi lc_time_fmt lc_time_fmt (public) dt_next_month_name->lc_time_fmt dt_get_info dt_get_info (public) dt_get_info->dt_next_month_name

Testcases:
dt_localized_procs

dt_num_days_in_month (public)

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

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_num_days_in_month dt_num_days_in_month (test acs-datetime) dt_num_days_in_month dt_num_days_in_month test_dt_num_days_in_month->dt_num_days_in_month dt_get_info dt_get_info (public) dt_get_info->dt_num_days_in_month

Testcases:
dt_num_days_in_month

dt_prev_month (public)

 dt_prev_month year month
Parameters:
year
month
Returns:
the ANSI date for the previous month

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_prev_next_month dt_prev_next_month (test acs-datetime) dt_prev_month dt_prev_month test_dt_prev_next_month->dt_prev_month ad_log ad_log (public) dt_prev_month->ad_log dt_get_info dt_get_info (public) dt_get_info->dt_prev_month

Testcases:
dt_prev_next_month

dt_prev_month_name (public)

 dt_prev_month_name year month
Parameters:
year
month
Returns:
Localized name of the previous month

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_localized_procs dt_localized_procs (test acs-datetime) dt_prev_month_name dt_prev_month_name test_dt_localized_procs->dt_prev_month_name ad_log ad_log (public) dt_prev_month_name->ad_log lc_clock_to_ansi lc_clock_to_ansi (public) dt_prev_month_name->lc_clock_to_ansi lc_time_fmt lc_time_fmt (public) dt_prev_month_name->lc_time_fmt dt_get_info dt_get_info (public) dt_get_info->dt_prev_month_name

Testcases:
dt_localized_procs

dt_sysdate (public)

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

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_sysdate_systime dt_sysdate_systime (test acs-datetime) dt_sysdate dt_sysdate test_dt_sysdate_systime->dt_sysdate calendar::adjust_date calendar::adjust_date (public, deprecated) calendar::adjust_date->dt_sysdate dt_ansi_to_pretty dt_ansi_to_pretty (public) dt_ansi_to_pretty->dt_sysdate dt_get_info dt_get_info (public) dt_get_info->dt_sysdate dt_widget_calendar_navigation dt_widget_calendar_navigation (public, deprecated) dt_widget_calendar_navigation->dt_sysdate dt_widget_day dt_widget_day (public, deprecated) dt_widget_day->dt_sysdate

Testcases:
dt_sysdate_systime

dt_systime (public)

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

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_sysdate_systime dt_sysdate_systime (test acs-datetime) dt_systime dt_systime test_dt_sysdate_systime->dt_systime dt_ansi_to_list dt_ansi_to_list (public) dt_ansi_to_list->dt_systime dt_widget_datetime dt_widget_datetime (public, deprecated) dt_widget_datetime->dt_systime packages/calendar/www/view-month-display.tcl packages/calendar/ www/view-month-display.tcl packages/calendar/www/view-month-display.tcl->dt_systime packages/calendar/www/view-one-day-display.tcl packages/calendar/ www/view-one-day-display.tcl packages/calendar/www/view-one-day-display.tcl->dt_systime packages/calendar/www/view-week-display.tcl packages/calendar/ www/view-week-display.tcl packages/calendar/www/view-week-display.tcl->dt_systime

Testcases:
dt_sysdate_systime

dt_valid_time_p (public)

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

Partial Call Graph (max 5 caller/called nodes):
%3 test_dt_sysdate_systime dt_sysdate_systime (test acs-datetime) dt_valid_time_p dt_valid_time_p test_dt_sysdate_systime->dt_valid_time_p test_dt_valid_time_p dt_valid_time_p (test acs-datetime) test_dt_valid_time_p->dt_valid_time_p

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
(defaults to "1") (optional)
-date_time_sep
(defaults to "&nbsp;") (optional)
-use_am_pm
(defaults to "0") (optional)
-default
(defaults to "none") (optional)
Parameters:
name
granularity (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:

Partial Call Graph (max 5 caller/called nodes):
%3 ad_log_deprecated ad_log_deprecated (public) dt_ansi_to_list dt_ansi_to_list (public) dt_export_value dt_export_value (private) dt_precision dt_precision (private) dt_round_to_precision dt_round_to_precision (private) dt_widget_datetime dt_widget_datetime dt_widget_datetime->ad_log_deprecated dt_widget_datetime->dt_ansi_to_list dt_widget_datetime->dt_export_value dt_widget_datetime->dt_precision dt_widget_datetime->dt_round_to_precision

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
(defaults to "t") (optional)
-hidden_value
(defaults to "00") (optional)
-default
(optional)
-format
(defaults to "%02d") (optional)
Parameters:
ask_for_value
name
start
end
default_value
interval (defaults to "1")
with_leading_zeros (defaults to "0")
hidden_value (defaults to "00")
Returns:
form numeric range, or hidden_value if ask_for_value is false.
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 dt_widget_datetime dt_widget_datetime (public, deprecated) dt_widget_maybe_range dt_widget_maybe_range dt_widget_datetime->dt_widget_maybe_range ad_log_deprecated ad_log_deprecated (public) dt_widget_maybe_range->ad_log_deprecated dt_export_value dt_export_value (private) dt_widget_maybe_range->dt_export_value dt_widget_numeric_range dt_widget_numeric_range (public, deprecated) dt_widget_maybe_range->dt_widget_numeric_range util::trim_leading_zeros util::trim_leading_zeros (public) dt_widget_maybe_range->util::trim_leading_zeros

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
selected_month (defaults to "0")
Returns:
a select widget for months of the year.
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 dt_widget_datetime dt_widget_datetime (public, deprecated) dt_widget_month_names dt_widget_month_names dt_widget_datetime->dt_widget_month_names ad_log_deprecated ad_log_deprecated (public) dt_widget_month_names->ad_log_deprecated dt_month_names dt_month_names (public) dt_widget_month_names->dt_month_names

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
begin
end
default (optional)
interval (defaults to "1")
with_leading_zeros (defaults to "0")
Returns:
an HTML select widget for a numeric range
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 dt_widget_maybe_range dt_widget_maybe_range (public, deprecated) dt_widget_numeric_range dt_widget_numeric_range dt_widget_maybe_range->dt_widget_numeric_range ad_log_deprecated ad_log_deprecated (public) dt_widget_numeric_range->ad_log_deprecated util::trim_leading_zeros util::trim_leading_zeros (public) dt_widget_numeric_range->util::trim_leading_zeros

Testcases:
No testcase defined.
[ show source ]