Time
Time transforms operate on time data. Substation uses nanosecond precision.
time.now
Generates the current timestamp in Unix nanoseconds.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.target_key | string | Places 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
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
format | string | Time format of the string as a pattern-based layout. | Yes |
location | string | Timezone 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
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
format | string | Time format of the string as a pattern-based layout. | Yes |
location | string | Timezone 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
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places 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
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places 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
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Sets 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
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Sets 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'}})
Updated 8 months ago