dt_ansi_to_list (public)
dt_ansi_to_list [ ansi_date ]
Defined in packages/acs-datetime/tcl/acs-datetime-procs.tcl
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):
- Testcases:
- dt_ansi_to_list, dt_early_years, dt_date_rollover_errors, dt_legacy_short_years
Source code: if {$ansi_date eq ""} { set ansi_date [dt_systime] } # Explicit formats preserve the century of four-digit ISO years, including # 0001..0099. Retain free-form parsing for other historically accepted inputs. if {[regexp {^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$} $ansi_date]} { set seconds [clock scan $ansi_date -format %Y-%m-%d] } elseif {[regexp {^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$} $ansi_date]} { set seconds [clock scan $ansi_date -format {%Y-%m-%d %H:%M:%S}] } else { set seconds [clock scan $ansi_date] } foreach item [split [clock format $seconds -format "%Y %m %d %H %M %S"] " "] { lappend date_info [util::trim_leading_zeros $item] } return $date_infoXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-datetime/tcl/acs-datetime-procs.xql