Date (Unix command): Difference between revisions

Content deleted Content added
m Fixed a reference. Please see Category:CS1 errors: dates.
GelvinM (talk | contribs)
Line 3:
==Option flags==
 
*+"''date format codes"'' Alters the output using the specified date conversion codes which are prefaced with at % sign. <ref name=Kerrisk>{{cite web |last=Kerrisk |first=Michael |date=Feb 2, 2025 |title=date(1) — Linux manual page |url=https://man7.org/linux/man-pages/man1/date.1.html |access-date=Mar 20, 2025 |website=man7.org |publisher=}}</ref> date +"Today is day %j of the year %Y and it’s a %A"
 
Output: date +"Today is day 078%j of the year 2025%Y and it’s a Wednesday %A"
 
Output: Today is day 078 of the year 2025 and it’s a Wednesday
 
*-d "''datestring''" or --date=''"datestring"'' Displays the quoted date. Can be used with the + flag. Date strings consist of ''calendar date items'' which express day month and year, ''and time of day items'' which express hour:minute:second''.'' Either item group is optional and they may appear in either order.<ref>{{cite web |author=<!-- not stated --> |title=Date input formats |url= https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.htmlwebsite=gnu.org |publisher=gnu.org |access-date=Mar 20, 2025}} </ref> Times and dates can be adjusted using ''relative item'' expressions such as + or - ''time unit'' as well as keywords such as ''now, yesterday, tomorrow, previous, next, first and last.<ref>{{cite web |author=<!-- not stated --> |title=Relative items in date strings |url= https://www.gnu.org/software/coreutils/manual/html_node/Relative-items-in-date-strings.html|website=gnu.org |publisher=gnu.org |access-date=Mar 20, 2025}}</ref>