Use the encode_timebox command to convert a human-readable timebox value that defines the when a role is enabled or disabled to an internal timebox value format.

The command converts the hexadecimal timebox value format described in Timebox value format to the internal hexadecimal value for a role. The command accepts a 168-bit value in hexadecimal format that delineates the hours of the week from midnight Sunday to 11 PM Saturday from most-significant bit to least‑significant bit. If a bit is set to 1, its corresponding hour is enabled for the role. If set to 0, its corresponding hour is disabled.

This command is useful for setting the timebox field with the set_role_field command.


encode_timebox strTimeBox


This command takes no options.


This command takes the following arguments:

Argument Type Description



A 42-digit hexadecimal timebox value. A value of zero disables all hours of the week. A value of FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF enables all hours of the week.

Return value

This command returns a decoded hexadecimal value that is the timebox value for a role.


>package require ade_lib
>encode_timebox $tb

This example returns the encoded 42 hexadecimal that indicates the role is disabled from midnight to one on Sunday:


Related ade_lib Tcl library commands

The following commands perform actions related to this command:

  • decode_timebox converts an internal timebox value to a decipherable format.
  • modify_timebox defines an hour of the week and enables or disables that hour in the timebox value.