Time formatting inside file name
All date/time parameters support a formatting attribute. Formatting attribute is specified after hash (#) symbol.
For example:
- %{setup-time#%Y} will return year, like: 2011
- %{setup-time#%m} will return month, like: 02
- %{setup-time#%Y-%m} will return both year and month, like: 2011-02
Table 1. Formatting codes
Code | Description |
---|---|
%a | Abbreviated weekday name |
%A | Full weekday name |
%b | Abbreviated month name |
%B | Full month name |
%d | Day of month as decimal number (01 – 31) |
%H | Hour in 24-hour format (00 – 23) |
%I | Hour in 12-hour format (01 – 12) |
%j | Day of year as decimal number (001 – 366) |
%m | Month as decimal number (01 – 12) |
%M | Minute as decimal number (00 – 59) |
%p | A.M./P.M. indicator for 12-hour clock |
%S | Second as decimal number (00 – 59) |
%U | Week of year as decimal number, with Sunday as first day of week (00 – 53) |
%w | Weekday as decimal number (0 – 6; Sunday is 0) |
%W | Week of year as decimal number, with Monday as first day of week (00 – 53) |
%y | Year without century, as decimal number (00 – 99) |
%Y | Year with century, as decimal number |
%% | Percent sign |
%u | Microseconds as decimal number |
Table 2. Examples of time formatting
Format string | Result |
---|---|
%Y-%m-%d | 2004-11-10 |
%H%M%S | 160201 |
%I%M%S | 040201 |
%d %b %Y, %A | 10 Nov 2004, Wednesday |
Note, for all examples, we used the same date/time, which is “10th of November 2004 16:02:01”. This day is a Wednesday.
Read also: