5.7 Format Strings
20240407
A common standard (based on strftime) for specifying a date format
string will replace any %X special characters with specific
components from the date (and time). For example, based on the result
of a call to the function lubridate::now(), which is
Tuesday, 1 September 2026, 17:06:35 PM, the format
is %A, %e %B %Y, %H:%M:%S %p.
The format strings that are available include:
%a\(\longrightarrow\) Tue (3 char day name)%A\(\longrightarrow\) Tuesday (full day name)%b\(\longrightarrow\) Sep (3 char month name)%B\(\longrightarrow\) September (full month name)%d\(\longrightarrow\) 01 (01-31 leading 0 numeric day of month)%e\(\longrightarrow\) 1 (1-31 numeric day of month)%H\(\longrightarrow\) 17 (00-23 numeric 24 hours)%I\(\longrightarrow\) 05 (01-11 numeric 12 hours)%-I\(\longrightarrow\) 5 (1-11 numeric hours no leading 0)%m\(\longrightarrow\) 09 (01-12 numeric month)%M\(\longrightarrow\) 06 (00-59 numeric minutes)%p\(\longrightarrow\) PM (AM,PM upper morning or afternoon)%P\(\longrightarrow\) pm (am,pm lower morning or afternoon)%S\(\longrightarrow\) 35 (00-60 numeric seconds)%-S\(\longrightarrow\) 35 (0-60 numeric seconds no leading 0)%y\(\longrightarrow\) 26 (00-99 2 digit year)%Y\(\longrightarrow\) 2026 (4 digit year)%Z\(\longrightarrow\) AEST (time zone)
A good resource is Fabrizio Musacchio’s strftime Cheat Sheet
If you find this curated material useful then you can consider a donation to support it's ongoing availability and give you access to the PDF version of this book. The material has been scoped up by Generative AI without permission or any kind of recompense so do consider a donation if you can afford it. Unlike Generative AI your access to this materials is freely given. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Togaware has a 30 year tradition of making popular open source software which includes sold privacy preserving productivity apps, rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0