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 - 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):
%3 lc_time_fmt lc_time_fmt (public) lc_datetime_to_clock lc_datetime_to_clock lc_time_fmt->lc_datetime_to_clock lc_time_tz_convert lc_time_tz_convert (public) lc_time_tz_convert->lc_datetime_to_clock

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_clock
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-lang/tcl/localization-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: