Skip to main content
All CollectionsBuild AutomationsWorkflowsData
Use Fractional Seconds in Torq: Enhance DateTime Precision
Use Fractional Seconds in Torq: Enhance DateTime Precision

Learn how to enhance the precision of datetime values by returning fractional seconds in Torq.

Updated over a month ago

Fractional seconds, representing fractions of a second in DateTime formats, are crucial for high-precision timekeeping. When monitoring high-speed computing systems, analyzing databases, auditing logs, etc., it is essential to have the granular detail provided by fractional seconds.

Torq uses string-format time, which supports returning fractional seconds. When returning fractional seconds, you can specify the number of digits to return. For instances when the DateTime is pertinent, it is important to match the number of digits to the format expected or received by the databases on all ends of the workflow.

By default, %f returns nanoseconds (9-digits). Add the number of digits you want between the % and f.

Fractional seconds

# of digits

Format

Decisecond

1

%Y-%m-%dT%H:%M:%S:%1f

Centisecond

2

%Y-%m-%dT%H:%M:%S:%2f

Millisecond

3

%Y-%m-%dT%H:%M:%S:%3f

Macrosecond

6

%Y-%m-%dT%H:%M:%S:%6f

Nanosecond

9

%Y-%m-%dT%H:%M:%S:%f

Did this answer your question?