Time

Time transforms operate on time data. Substation uses nanosecond precision.

time.now

Generates the current timestamp in Unix nanoseconds.

Settings

FieldTypeDescriptionRequired
object.target_keystringPlaces a value into an object after transformation.No

Example

sub.transform.time.now(
  settings={object: {target_key: 'now'}}
)
sub.tf.time.now({obj: {trg: 'now'}})

time.from.string

Converts time from a string to Unix nanoseconds.

Settings

FieldTypeDescriptionRequired
object.source_keystringRetrieves a value from an object for transformation.No
object.target_keystringPlaces a value into an object after transformation.No
formatstringTime format of the string as a pattern-based layout.Yes
locationstringTimezone abbreviation of the string.

Defaults to UTC.
No

Example

sub.transform.time.from.string(
  settings={object: {source_key: 'time', target_key: 'unix_nano'}, format: '2006-01-02T15:04:05.000Z'}
)
sub.tf.time.from.str({obj: {src: 'time', trg: 'unix_nano'}, format: '2006-01-02T15:04:05.000Z'})

time.to.string

Converts time from Unix nanoseconds to a string.

Settings

FieldTypeDescriptionRequired
object.source_keystringRetrieves a value from an object for transformation.No
object.target_keystringPlaces a value into an object after transformation.No
formatstringTime format of the string as a pattern-based layout.Yes
locationstringTimezone abbreviation of the string.

Defaults to UTC.
No

Example

sub.transform.time.to.string(
  settings={object: {source_key: 'unix_nano', target_key: 'time'}, format: '2006-01-02T15:04:05.000Z'}
)
sub.tf.time.to.str({obj: {src: 'unix_nano', trg: 'time'}, format: '2006-01-02T15:04:05.000Z'})

time.from.unix

Converts time from Unix seconds to Unix nanoseconds.

Settings

FieldTypeDescriptionRequired
object.source_keystringRetrieves a value from an object for transformation.No
object.target_keystringPlaces a value into an object after transformation.No

Example

sub.transform.time.from.unix(
  settings={object: {source_key: 'unix', target_key: 'unix_nano'}}
)
sub.tf.time.from.unix({obj: {src: 'unix', trg: 'unix_nano'}})

time.from.unix_milli

Converts time from Unix milliseconds to Unix nanoseconds.

Settings

FieldTypeDescriptionRequired
object.source_keystringRetrieves a value from an object for transformation.No
object.target_keystringPlaces a value into an object after transformation.No

Example

sub.transform.time.from.unix(
  settings={object: {source_key: 'unix_milli', target_key: 'unix_nano'}}
)
sub.tf.time.from.unix({obj: {src: 'unix_milli', trg: 'unix_nano'}})

time.to.unix

Converts time from Unix nanoseconds to Unix seconds.

Settings

FieldTypeDescriptionRequired
object.source_keystringRetrieves a value from an object for transformation.No
object.target_keystringSets a value into an object after transformation.No

Example

sub.transform.time.to.unix(
  settings={object: {source_key: 'unix_nano', target_key: 'unix'}}
)
sub.tf.time.to.unix(settings={obj: {src: 'unix_nano', trg: 'unix'}})

time.to.unix_milli

Converts time from Unix nanoseconds to Unix milliseconds.

Settings

FieldTypeDescriptionRequired
object.source_keystringRetrieves a value from an object for transformation.No
object.target_keystringSets a value into an object after transformation.No

Example

sub.transform.time.to.unix(
  settings={object: {source_key: 'unix_nano', target_key: 'unix_milli'}}
)
sub.tf.time.to.unix(settings={obj: {src: 'unix_nano', trg: 'unix_milli'}})