Skip to content

Instantly share code, notes, and snippets.

@63phc
Created July 28, 2018 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 63phc/cca34ac3b9acfb39faa2b59e23efb3ba to your computer and use it in GitHub Desktop.
Save 63phc/cca34ac3b9acfb39faa2b59e23efb3ba to your computer and use it in GitHub Desktop.
TIME FORMAT
Code Example Meaning
%a Mon # Weekday as locale’s abbreviated name.
%A Monday # Weekday as locale’s full name.
%w 1 # Weekday as a decimal number, where 0 is Sunday and 6 is Saturday.
%d 30 # Day of the month as a zero-padded decimal number.
%-d 30 # Day of the month as a decimal number. (Platform specific)
%b Sep # Month as locale’s abbreviated name.
%B September # Month as locale’s full name.
%m 9 # Month as a zero-padded decimal number.
%-m 9 # Month as a decimal number. (Platform specific)
%y 13 # Year without century as a zero-padded decimal number.
%Y 2013 # Year with century as a decimal number.
%H 7 # Hour (24-hour clock) as a zero-padded decimal number.
%-H 7 # Hour (24-hour clock) as a decimal number. (Platform specific)
%I 7 # Hour (12-hour clock) as a zero-padded decimal number.
%-I 7 # Hour (12-hour clock) as a decimal number. (Platform specific)
%p AM # Locale’s equivalent of either AM or PM.
%M 6 # Minute as a zero-padded decimal number.
%-M 6 # Minute as a decimal number. (Platform specific)
%S 5 # Second as a zero-padded decimal number.
%-S 5 # Second as a decimal number. (Platform specific)
%f 0 # Microsecond as a decimal number, zero-padded on the left.
%z # UTC offset in the form +HHMM or -HHMM (empty string if the the object is naive).
%Z # Time zone name (empty string if the object is naive).
%j 273 # Day of the year as a zero-padded decimal number.
%-j 273 # Day of the year as a decimal number. (Platform specific)
%U 39 # Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0.
%W 39 # Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0.
%c Mon Sep 30 07:06:05 2013 # Locale’s appropriate date and time representation.
%x 09/30/13 # Locale’s appropriate date representation.
%X 07:06:05 # Locale’s appropriate time representation.
%% % # A literal '%' character.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment