lc_datetime_to_clock (private)
lc_datetime_to_clock datetime
Defined in packages/acs-lang/tcl/localization-procs.tcl
Converts a datetime in one of the supported formats to a clock value.
- Parameters:
- datetime (required)
- A time string in one of the following formats as from clock tcl command specifications: "%Y-%m-%d %H:%M:%S", "%Y-%m-%d %H:%M" and "%Y-%m-%d". Database timestamps such as "2019-12-16 12:50:14.049896+01" are also tolerated, by normalizing them to "2019-12-16 12:50:14". Note that in this case all information about timezone and fractions of second will be discarded.
- Returns:
- integer
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set datetime [string range [string trim $datetime] 0 18] foreach format { "%Y-%m-%d %H:%M:%S" "%Y-%m-%d %H:%M" "%Y-%m-%d" } { set invalid_format_p [catch { set date_clock [clock scan $datetime -format $format] }] if {!$invalid_format_p} { break } } if {$invalid_format_p} { error "Invalid date: $datetime" } return $date_clockXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-lang/tcl/localization-procs.xql