Format Strings

Table of Contents

Introduction

 This page documents these various format strings.

Python Datetime format

For datetime formatting, 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.

This table lists the most commonly used format directives. See also the Python documentation for datetime format strings for a more complete reference.

Directive

Meaning

Example

Directive

Meaning

Example

%a

Weekday as locale’s abbreviated name.

Sun, Mon, …, Sat (en_US);

So, Mo, …, Sa (de_DE)

%A

Weekday as locale’s full name.

Sunday, Monday, etc.

%d

Day of the month as a zero-padded decimal number.

01, 02, …, 31

%b

Month as locale’s abbreviated name.

Jan, Feb, …, Dec

%B

Month as locale’s full name.

January, February, …, December

%m

Month as a zero-padded decimal number.

01, 02, …, 12

%Y

Year with century as a decimal number.

1970, 1988, 2001, 2013

%H

Hour (24-hour clock) as a zero-padded decimal number.

00, 01, …, 23

%I

Hour (12-hour clock) as a zero-padded decimal number.

01, 02, …, 12

%p

Either AM or PM.

AM, PM

%M

Minute as a zero-padded decimal number.

00, 01, …, 59

%S

Second as a zero-padded decimal number.

00, 01, …, 59

%s

Number of seconds (timestamp) since 1970-01-01 00:00:00 UTC.

1538524800

%%

A literal '%' character.

%

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.

This table lists the most commonly used format directives. See also the Moment.js documentation for date tokens for a more complete reference.

Directive

Meaning

Example

Directive

Meaning

Example

ddd

Weekday as locale’s abbreviated name.

Sun, Mon, …, Sat (en_US);

So, Mo, …, Sa (de_DE)

dddd

Weekday as locale’s full name.

Sunday, Monday, etc.

DD

Day of the month as a zero-padded decimal number.

01, 02, …, 31

MMM

Month as locale’s abbreviated name.

Jan, Feb, …, Dec

MMMM

Month as locale’s full name.

January, February, …, December

MM

Month as a zero-padded decimal number.

01, 02, …, 12

YYYY

Year with century as a decimal number.

1970, 1988, 2001, 2013

HH

Hour (24-hour clock) as a zero-padded decimal number.

00, 01, …, 23

hh

Hour (12-hour clock) as a zero-padded decimal number.

01, 02, …, 12

a

Either AM or PM.

AM, PM

mm

Minute as a zero-padded decimal number.

00, 01, …, 59

ss

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



Number format

For numeric facets a % syntax is used, which supports the following formats.

This table lists the most commonly used format directives. See also the Python documentation for datetime format strings for a more complete reference.

Purpose

Format

Examples format

Example output (for facet value 123456.789)

Purpose

Format

Examples format

Example output (for facet value 123456.789)

Facet value

%d

%d EUR

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