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 ]
Defined in packages/acs-datetime/tcl/acs-datetime-procs.tcl
Deprecated. Invoking this procedure generates a warning.
- Switches:
- -show_date (optional, defaults to
"1"
)- -date_time_sep (optional, defaults to
" "
)- -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:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: ad_log_deprecated proc dt_widget_datetime set to_precision [dt_precision $granularity] set show_day [expr {$to_precision < 1441}] set show_hours [expr {$to_precision < 61}] set show_minutes [expr {$to_precision < 60}] set show_seconds [expr {$to_precision < 1}] if {$to_precision == 0} { set to_precision 1 } switch $default { none { set value [dt_systime] } now { set value [dt_systime] } default { set value [lc_time_fmt $default "%Y-%m-%d %H:%M:%S"] } } set parsed_date [dt_ansi_to_list $value] set year [lindex $parsed_date 0] set month [lindex $parsed_date 1] set day [lindex $parsed_date 2] set hours [lindex $parsed_date 3] set minutes [lindex $parsed_date 4] set seconds [lindex $parsed_date 5] # Kludge to get minutes rounded. Should make general-purpose for # the other values too... if {$to_precision < 60} { set minutes [expr {[dt_round_to_precision $minutes $to_precision] % 60}] } if {$default eq "none"} { set year "" set month "" set day "" set hours "" set minutes "" set seconds "" } if {$show_date} { append input [dt_widget_month_names "$name.month" $month] append input [dt_widget_maybe_range $show_day "$name.day" 1 31 $day 1 0 1] append input "<input name=\"$name.year\" size=5 maxlength=4 value=\"$year\"> $date_time_sep " } if {$use_am_pm} { if { $hours > 12 } { append input [dt_widget_maybe_range $show_hours "$name.hours" 1 12 [expr {$hours - 12}] 1 0] } elseif {$hours == 0} { append input [dt_widget_maybe_range $show_hours "$name.hours" 1 12 12 1 0] } else { append input [dt_widget_maybe_range $show_hours "$name.hours" 1 12 $hours 1 0] } } else { append input [dt_widget_maybe_range $show_hours "$name.hours" 0 23 $hours 1 0] } if {$show_minutes} { append input ":" } append input [dt_widget_maybe_range $show_minutes "$name.minutes" 0 59 $minutes $to_precision 1] if {$show_seconds} { append input ":" } append input [dt_widget_maybe_range $show_seconds "$name.seconds" 0 59 $seconds 1 1] if {$use_am_pm} { if {$hours < 12 || ! $show_hours} { set am_selected " selected" set pm_selected "" } else { set am_selected "" set pm_selected " selected" } append input " <select name=\"${name}.ampm\"> <option value=0${am_selected}>AM <option value=1${pm_selected}>PM </select>" } else { append input [dt_export_value "${name}.ampm" "AM"] } return $inputXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-datetime/tcl/acs-datetime-procs.xql