Skip to content

Commit

Permalink
Linux: Date #time 10m
Browse files Browse the repository at this point in the history
  • Loading branch information
astromatt committed Sep 15, 2022
1 parent 3ee33b9 commit bf2fd9d
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions linux/system/date.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,60 @@ Paths
* ``/etc/localtime``


Date Formatting
---------------
.. csv-table:: Date and time parsing parameters
:widths: 5, 35, 60
:header: "Directive", "Example", "Meaning"

"``%a``", "Sun, Mon, ..., Sat", "Weekday as locale's abbreviated name"
"``%A``", "Sunday, Monday, ..., Saturday (en_US)", "Weekday as locale's full name"
"``%w``", "0, 1, ..., 6", "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday"
"``%d``", "01, 02, ..., 31", "Day of the month as a zero-padded decimal number"
"``%b``", "Jan, Feb, ..., Dec (en_US)", "Month as locale's abbreviated name"
"``%B``", "January, February, ..., December (en_US)", "Month as locale's full name"
"``%m``", "01, 02, ..., 12", "Month as a zero-padded decimal number"
"``%y``", "00, 01, ..., 99", "Year without century as a zero-padded decimal number"
"``%Y``", "0001, 0002, ..., 2013, 2014, ..., 9998, 9999", "Year with century as a decimal number"
"``%H``", "00, 01, ..., 23", "Hour (24-hour clock) as a zero-padded decimal number"
"``%I``", "01, 02, ..., 12", "Hour (12-hour clock) as a zero-padded decimal number"
"``%p``", "AM, PM (en_US)", "Locale's equivalent of either AM or PM"
"``%M``", "00, 01, ..., 59", "Minute as a zero-padded decimal number"
"``%S``", "00, 01, ..., 59", "Second as a zero-padded decimal number"
"``%f``", "000000, 000001, ..., 999999", "Microsecond as a decimal number, zero-padded on the left"
"``%z``", "(empty), +0000, -0400, +1030", "UTC offset in the form +HHMM or -HHMM (empty string if the object is naive)"
"``%Z``", "(empty), UTC, EST, CST", "Time zone name (empty string if the object is naive)"
"``%j``", "001, 002, ..., 366", "Day of the year as a zero-padded decimal number"
"``%U``", "00, 01, ..., 53", "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``", "00, 01, ..., 53", "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``", "Tue Aug 16 21:30:00 1988 (en_US)", "Locale's appropriate date and time representation"
"``%x``", "08/16/1988 (en_US); 16.08.1988 (de_DE)", "Locale's appropriate date representation"
"``%X``", "21:30:00", "Locale's appropriate time representation"
"``%%``", "%", "A literal ``%`` character"
"``%G``", "0001, 0002, ..., 2013, 2014, ..., 9998, 9999", "ISO 8601 year with century representing the year that contains the greater part of the ISO week (``%V``)"
"``%u``", "1, 2, ..., 7", "ISO 8601 weekday as a decimal number where 1 is Monday"
"``%V``", "01, 02, ..., 53", "ISO 8601 week as a decimal number with Monday as the first day of the week. Week 01 is the week containing Jan 4"

.. csv-table:: Leading Zero
:widths: 55, 15, 15, 15
:header: "Meaning", "With", "Without"

"day", ``%d``, ``%-d``
"hour 24h", ``%H``, ``%-H``
"hour 12h", ``%I``, ``%-I``
"day of a year", ``%j``, ``%-j``
"month", ``%m``, ``%-m``
"minute", ``%M``, ``%-M``
"second", ``%S``, ``%-S``
"week number (Sunday first)", ``%U``, ``%-U``
"week number (Monday first)", ``%W``, ``%-W``
"weekday (Sunday first)", ``%w``, ``%-w``
"year short", ``%y``, ``%-y``
"year long", ``%Y``, ``%-Y``


Date
----
* https://python.astrotech.io/intermediate/datetime/format.html#parameters

.. code-block:: console
$ date -I
Expand Down

0 comments on commit bf2fd9d

Please sign in to comment.