Format Strings#
Squirro supports format strings in many places within the software platform to specify how numbers and dates are displayed or processed. This page documents these various format strings.
Python Datetime Format#
For datetime formattings, such as the input format of the data loader, Python datetime format strings are used.
For example, the Squirro standard format of 2018-12-25T11:19:20
is written in this syntax as %Y-%m-%dT%H:%M:%S
.
The following table lists the most commonly used format directives:
Directive |
Meaning |
Example |
|
Weekday as locale’s abbreviated name. |
Sun, Mon, …, Sat (en_US); So, Mo, …, Sa (de_DE) |
|
Weekday as locale’s full name. |
Sunday, Monday, etc. |
|
Day of the month as a zero-padded decimal number. |
01, 02, …, 31 |
|
Month as locale’s abbreviated name. |
Jan, Feb, …, Dec |
|
Month as locale’s full name. |
January, February, …, December |
|
Month as a zero-padded decimal number. |
01, 02, …, 12 |
|
Year with century as a decimal number. |
1970, 1988, 2001, 2013 |
|
Hour (24-hour clock) as a zero-padded decimal number. |
00, 01, …, 23 |
|
Hour (12-hour clock) as a zero-padded decimal number. |
01, 02, …, 12 |
|
Either AM or PM. |
AM, PM |
|
Minute as a zero-padded decimal number. |
00, 01, …, 59 |
|
Second as a zero-padded decimal number. |
00, 01, …, 59 |
|
Number of seconds (timestamp) since 1970-01-01 00:00:00 UTC. |
1538524800 |
|
A literal |
% |
Reference: See the official Python documentation for Datetime Format Strings for a more complete reference.
Moment Datetime Format#
For display purposes in the user interface, the moment datetime format is used.
For example the Squirro standard format of 2018-12-25T11:19:20
is written in this syntax as YYYY-MM-DD[T]HH:mm:ss
.
The following table lists the most commonly used format directives:
Directive |
Meaning |
Example |
|
Weekday as locale’s abbreviated name. |
Sun, Mon, …, Sat (en_US); So, Mo, …, Sa (de_DE) |
|
Weekday as locale’s full name. |
Sunday, Monday, etc. |
|
Day of the month as a zero-padded decimal number. |
01, 02, …, 31 |
|
Month as locale’s abbreviated name. |
Jan, Feb, …, Dec |
|
Month as locale’s full name. |
January, February, …, December |
|
Month as a zero-padded decimal number. |
01, 02, …, 12 |
|
Year with century as a decimal number. |
1970, 1988, 2001, 2013 |
|
Hour (24-hour clock) as a zero-padded decimal number. |
00, 01, …, 23 |
|
Hour (12-hour clock) as a zero-padded decimal number. |
01, 02, …, 12 |
|
Either AM or PM. |
AM, PM |
|
Minute as a zero-padded decimal number. |
00, 01, …, 59 |
|
Second as a zero-padded decimal number. |
00, 01, …, 59 |
[anything] |
Use square brackets to escape tokens that could be confused as date formatting tokens |
Reference: See the official Moment.js documentation for Date Tokens for a more complete reference.
Number Format#
For numeric facets, a % syntax is used, which supports the following formats.
The following table lists the most commonly used format directives:
Purpose |
Format |
Examples format |
Example output (for facet value 123456.789) |
Facet value |
%d |
|
123456.789 EUR |
$% |
$123456.789 |
||
Thousands and floating point separators |
%[thousand][floating_point]d |
%’d EUR |
123’456.789 EUR |
%.,d EUR |
123.456,789 EUR |
||
%’,d EUR |
123’456,789 EUR |
||
Rounding precision |
%[precision]d |
%2d EUR |
123456.79 EUR |
%,1d EUR |
123456,8 EUR |
||
%’,0dEUR |
123’456 EUR |
Reference: See the official Python documentation for Datetime Format Strings for a more complete reference.