Date & Time
Date and time expressions use the JSONata Date/Time functions to return various formats of date/time, date, or time. These expressions are used to get the current timestamp in ISO 8601 formatted string, use an expression over the timestamp to convert the timestamp into a specific format.
Configuration
Current timestamp as ISO 8601
=$now()
Current datetime in milliseconds
=$toMillis($now())
Current date [M]/[D]/[Y]
=$fromMillis($toMillis($now()), '[M]/[D]/[Y]')
Current date [M01]/[D01]/[Y0001]
=$fromMillis($toMillis($now()), '[M01]/[D01]/[Y0001]')
Current datetime '[M01]/[D01]/[Y0001] [H01]:[m01]:[s01]'
=$fromMillis($toMillis($now()), '[M01]/[D01]/[Y0001] [H01]:[m01]:[s01]')
Current date [MI]/[DI]/[YI]
=$fromMillis($toMillis($now()), '[MI]/[DI]/[YI]')
Current date [D1o] [MNn] [Y]
=$fromMillis($toMillis($now()), '[D1o] [MNn] [Y]')
Current day
=$fromMillis($toMillis($now()), '[FNn]')
Current time
=$fromMillis($toMillis($now()), '[H01]:[m01]:[s01]')
Current time am/pm
=$fromMillis($toMillis($now()), '[h#1]:[m01][P]')
Current time '[H01]:[m01]:[s01] [z]', '-0500'
=$fromMillis($toMillis($now()), '[H01]:[m01]:[s01] [z]', '-0500')
Convert UTC to milliseconds
=$toMillis()
Convert millisecond to UTC
=$fromMillis()
Consideration
When using
=$now()on a component level, the date/time is not refreshed when navigating out and into the jig. To cater to this scenario, add anonFocuswith aset-stateaction to the jig.
children:
- type: component.entity
options:
children:
- type: component.entity-field
options:
label: Order Date
value: [email protected]onFocus:
type: action.set-state
options:
state: [email protected]
value: =$now()Be careful when using complex expressions, such as expressions that iterate one datasource across another, as your solution performance could become slower. To avoid this, try to use the datasource queries to get the desired result rather than an expression.
Examples and code snippets

This example uses a component.enitity to show the results of various date/time functions
See the full code sample in GitHub.
children:
- type: component.entity
options:
children:
- type: component.entity-field
options:
label: Current timestamp as ISO 8601
value: =$now()
- type: component.entity-field
options:
label: Current datetime in milliseconds
value: =$toMillis($now())
- type: component.entity-field
options:
label: Current date [M]/[D]/[Y]
value: =$fromMillis($toMillis($now()), '[M]/[D]/[Y]')
- type: component.entity-field
options:
label: Current date [M01]/[D01]/[Y0001]
value: =$fromMillis($toMillis($now()), '[M01]/[D01]/[Y0001]')
- type: component.entity-field
options:
label: Current datetime '[M01]/[D01]/[Y0001] [H01]:[m01]:[s01]'
value: =$fromMillis($toMillis($now()), '[M01]/[D01]/[Y0001] [H01]:[m01]:[s01]')
- type: component.entity-field
options:
label: Current date [MI]/[DI]/[YI]
value: =$fromMillis($toMillis($now()), '[MI]/[DI]/[YI]')
- type: component.entity-field
options:
label: Current date [D1o] [MNn] [Y]
value: =$fromMillis($toMillis($now()), '[D1o] [MNn] [Y]')
- type: component.entity-field
options:
label: Current day
value: =$fromMillis($toMillis($now()), '[FNn]')
- type: component.entity-field
options:
label: Current time
value: =$fromMillis($toMillis($now()), '[H01]:[m01]:[s01]')
- type: component.entity-field
options:
label: Current time am/pm
value: =$fromMillis($toMillis($now()), '[h#1]:[m01][P]')
- type: component.entity-field
options:
label: Current time '[H01]:[m01]:[s01] [z]', '-0500'
value: =$fromMillis($toMillis($now()), '[H01]:[m01]:[s01] [z]', '-0500')Last updated
Was this helpful?