NAME

timestamp - A Dmhwidget for editing timestamp values

SYNOPSIS

dmhwidgets::timestamp pathName ?options?

INHERITANCE

itk::Widget <- Iwidgets::Labeledwidget <- dmhwidgets::Timestamp

STANDARD OPTIONS

activebackground activeforeground background borderwidth cursor disabledforeground font foreground highlightcolor highlightthickness insertbackground insertborderwidth insertofftime insertontime insertwidth selectbackground selectborderwidth selectcolor selectforeground

See the options manual entry for details on the standard options.

INHERITED OPTIONS

labelbitmap labelfont labelimage labelmargin labelpos labeltext labelvariable

See the Labeledwidget manual entry for details on the standard options.

WIDGET-SPECIFIC OPTIONS

Name: choose  Class: Choose  Command-Line Switch: -choose  Default value: {0 0 0}

Used as a list of three boolean elements, corresponding to timestamp value choices in the past, the present, and the future. If any of the values are non-zero, a Choose button is provided for the user to press and select a timestamp value from a union of the allowed choices.

Name: decimals  Class: Decimals  Command-Line Switch: -decimals  Default value: 0

An integer value from 0 to 9 specifying the number of decimal digits to be displayed or entered.

DESCRIPTION

The timestamp command creates a widget for editing timestamp values, and a new Tcl command whose name is pathname. The command is then used to invoke various methods of the widget. The command has the general form:

pathName option ?arg arg ... arg?

WIDGET-SPECIFIC METHODS

pathName get [format]
If a valid timestamp is represented, the value is returned in the caller's specified format. If an invalid value exists, an empty string is returned. The format choices are:
ts
YYYY-MM-DD HH:MM:SS.uuuuuu
tsN
N can vary 0..9. Same as ts except there are N decimal places.
iso
YYYY-MM-DDTHH:MM:SS.uuuuuu
secs
the count of seconds since the epoch - localtime format 2
secs_micros
the count of seconds and microseconds since the epoch - localtime format 11

pathName isvalid
Returns 1 if the displayed value is a valid timestamp, otherwise 0.

pathName show timestamp
Sets the displayed value. The input format is expected to be YYYY-MM-DDXhh:mm:ss[.uuuuuu], where X is any character.

EXAMPLE

package require dmh
package require Iwidgets
package require Dmhwidgets


dmhwidgets::timestamp .timestamp -labeltext "timestamp:" -choose {1 1 1}
pack .timestamp -side top -fill x -expand yes -padx 10 -pady 10
button .timestamp_ok -text Ok -command [list timestamp_ok .timestamp]
pack .timestamp_ok -side top -padx 20m -pady 2m

proc timestamp_ok ts {
    set txt [$ts get]
    puts $txt
    }

AUTHOR

Hume Integration Software, www.hume.com

KEYWORDS

calendar, date, time, UTC, widget