Date (Unix command): Difference between revisions

Content deleted Content added
GelvinM (talk | contribs)
Created a page documenting Unix date command.
 
m Added reflist
Line 6:
 
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>
Line 17 ⟶ 16:
 
date -d "next Tuesday +2 years -8 hours + 3 days"
 
 
*-f ''filename'' or --file''=filename'' where the referenced file contains one of more date strings on separate lines which are converted either to the default date format or the format specified by the '''+''' flag. Incompatible with the '''-d''' flag.
 
 
 
*-r or --reference=''filename ''- outputs the last modification time of the file
Line 28 ⟶ 24:
 
*-u or --UTC displays [[Universal time|Greenwich Mean Time]]
==References==
{{reflist}}