Time Formatting - flarom/cohesion GitHub Wiki

General use

Code Example Description
%a Wed Abbreviated weekday name
%A Wednesday Full weekday name
%w 3 Weekday as a decimal number
%d 05 Day of the month with leading zero
%-d 5 Day of the month without leading zero
%B June Full month name
%b Jun Abbreviated month name
%m 06 Month as a number with leading zero
%-m 6 Month as a number without leading zero
%Y 2025 Full year with century
%y 25 Year without century, as two digits
%H 14 Hour (24-hour clock) with leading zero
%-H 14 Hour (24-hour clock) without leading zero
%I 02 Hour (12-hour clock) with leading zero
%-I 2 Hour (12-hour clock) without leading zero
%p PM AM or PM indicator
%M 23 Minute with leading zero
%-M 23 Minute without leading zero
%S 45 Second with leading zero
%-S 45 Second without leading zero

Misc

Code Example Description
%f 000000 Microsecond as a decimal number, zero-padded to 6 digits
%z -0300 UTC offset in the form ±HHMM[SS[.ffffff]]
%Z São Paulo Time zone name
%j 156 Day of the year as a zero-padded decimal number
%-j 156 Day of the year as a decimal number.
%U 22 Week number of the year
%-U 22 Week number of the year
%W 22 Week number of the year
%-W 22 Week number of the year
%c Wed Jun 5 14:23:45 2025 System date and time representation
%x 06/05/25 System date representation
%X 14:23:45 System time representation
%% % A literal '%' character