When creating a dataset it can be useful to format timestamps in your preferred fashion.
For example, show only days of the week, start the week on a Sunday, show only the month number etc.
You can achieve this using the formula builder + string formatting when creating your dataset as shown below.
The '%a' syntax will extract only the weekday information from the Timestamp.
Ensure that you have selected the appropriate output type at the bottom. In this case it should be a string.
For all other types of formatting options, please see the syntax below.
Format Specifier | Description |
---|---|
%a | Abbreviated weekday name (Sun..Sat) |
%b | Abbreviated month name (Jan..Dec) |
%c | Month in year, numeric (0..12) |
%D | Day of month as ordinal number (1st, 2nd, … 24th) |
%d | Day of month, padded to 2 digits (00..31) |
%e | Day of month (0..31) |
%f | Microseconds, padded to 6 digits (000000..999999) |
%H | Hour in 24-hour clock, padded to 2 digits (00..23) |
%h | Hour in 12-hour clock, padded to 2 digits (01..12) |
%I | Hour in 12-hour clock, padded to 2 digits (01..12) |
%i | Minutes, numeric (00..59) |
%j | Day of year, padded to 3 digits (001..366) |
%k | Hour in 24-hour clock (0..23) |
%l | Hour in 12-hour clock (1..12) |
%M | Month name (January..December) |
%m | Month in year, numeric, padded to 2 digits (00..12) |
%p | AM or PM |
%r | Time, 12-hour (hh:mm:ss followed by AM or PM) |
%S | Seconds, padded to 2 digits (00..59) |
%s | Seconds, padded to 2 digits (00..59) |
%T | Time, 24-hour (hh:mm:ss) |
%U | Week number, sunday as first day of the week, first week of the year (01) is the one starting in this year, week 00 starts in last year (00..53) |
%u | Week number, monday as first day of the week, first week of the year (01) is the one with at least 4 days in this year (00..53) |
%V | Week number, sunday as first day of the week, first week of the year (01) is the one starting in this year, uses the week number of the last year, if the week started in last year (01..53) |
%v | Week number, monday as first day of the week, first week of the year (01) is the one with at least 4 days in this year, uses the week number of the last year, if the week started in last year (01..53) |
%W | Weekday name (Sunday..Saturday) |
%w | Day of the week (0=Sunday..6=Saturday) |
%X | weekyear, sunday as first day of the week, numeric, four digits; used with %V |
%x | weekyear, monday as first day of the week, numeric, four digits; used with %v |
%Y | Year, numeric, four digits |
%y | Year, numeric, two digits |
%% | A literal ‘%’ character |
%x | x, for any ‘x’ not listed above |