Difference between revisions of "Shell Commands/Date"
From MorphOS Library
(Created page with "'''Date''' - Displays or sets the date and time of the system DAY, DATE, TIME, TO=VER/K <nowiki> DAY - sets the day to DAY...") |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 3: | Line 3: | ||
DAY, DATE, TIME, TO=VER/K | DAY, DATE, TIME, TO=VER/K | ||
<nowiki> | <nowiki> | ||
| − | DAY | + | DAY - sets the day to DAY |
| − | DATE - sets the date to DATE | + | DATE - sets the date to DATE |
| − | TIME - sets the time to TIME | + | TIME - sets the time to TIME |
| − | TO | + | TO - sets the date to that of the TO file |
| + | LFORMAT - defines a string to specially format the output</nowiki> | ||
Date with no argument displays the currently set system time and date, | Date with no argument displays the currently set system time and date, | ||
including the day of the week. Time is displayed using a 24-hour clock. | including the day of the week. Time is displayed using a 24-hour clock. | ||
| Line 15: | Line 16: | ||
The number or the first three letters of the month (in English) | The number or the first three letters of the month (in English) | ||
must be used, as well as the last two digits of the year. | must be used, as well as the last two digits of the year. | ||
| + | |||
| + | The LFORMAT option modifies the output of Date. The available substitution operators are: | ||
| + | <nowiki> | ||
| + | %a - Abbreviated weekday name | ||
| + | %A - Weekday name | ||
| + | %b - Abbreviated month name | ||
| + | %B - Month name | ||
| + | %c - The same as "%a %b %d %H:%M:%S %Y" | ||
| + | %C - The same as "%a %b %e %T %Y" | ||
| + | %d - Day number with leading zeros | ||
| + | %D - The same as "%m/%d/%y" | ||
| + | %e - Day number with leading spaces | ||
| + | %F - The same as "%Y-%m-%d" | ||
| + | %h - Abbreviated month name | ||
| + | %H - Hour using 24 hour style with leading zeros | ||
| + | %I - Hour using 12 hour style with leading zeros | ||
| + | %j - Julian date | ||
| + | %m - Month number with leading zeros | ||
| + | %M - The number of minutes with leading zeros | ||
| + | %n - Linefeed | ||
| + | %p - AM or PM string in upper- or lowercase depending on the country selection | ||
| + | %P - "%p" in lowercase | ||
| + | %q - Hour using 24 hour style | ||
| + | %Q - Hour using 12 hour style | ||
| + | %r - The same as "%I:%M:%S %p" | ||
| + | %R - The same as "%H:%M" | ||
| + | %S - The number of seconds with leading zeros | ||
| + | %t - Tab | ||
| + | %T - The same as "%H:%M:%S" | ||
| + | %U - The week number, taking Sunday as the first day of the week | ||
| + | %w - The weekday number | ||
| + | %W - The week number, taking Monday as the first day of the week | ||
| + | %x - The same as "%m/%d/%y" | ||
| + | %X - The same as "%H:%M:%S" | ||
| + | %y - The year using two digits with leading zeros | ||
| + | %Y - The year using four digits with leading zeros</nowiki> | ||
| + | |||
| + | Example: | ||
| + | <nowiki> | ||
| + | Ram Disk:> Date LFORMAT="Today is %A." | ||
| + | Today is Tuesday.</nowiki> | ||
Latest revision as of 18:25, 3 February 2026
Date - Displays or sets the date and time of the system
DAY, DATE, TIME, TO=VER/K
DAY - sets the day to DAY DATE - sets the date to DATE TIME - sets the time to TIME TO - sets the date to that of the TO file LFORMAT - defines a string to specially format the output
Date with no argument displays the currently set system time and date, including the day of the week. Time is displayed using a 24-hour clock.
Date DATE sets only the date. The format for entry and display of DATE is DD-MMM-YY (day-month-year). The hyphens between the arguments are required. A leading zero in the date is not necessary. The number or the first three letters of the month (in English) must be used, as well as the last two digits of the year.
The LFORMAT option modifies the output of Date. The available substitution operators are:
%a - Abbreviated weekday name %A - Weekday name %b - Abbreviated month name %B - Month name %c - The same as "%a %b %d %H:%M:%S %Y" %C - The same as "%a %b %e %T %Y" %d - Day number with leading zeros %D - The same as "%m/%d/%y" %e - Day number with leading spaces %F - The same as "%Y-%m-%d" %h - Abbreviated month name %H - Hour using 24 hour style with leading zeros %I - Hour using 12 hour style with leading zeros %j - Julian date %m - Month number with leading zeros %M - The number of minutes with leading zeros %n - Linefeed %p - AM or PM string in upper- or lowercase depending on the country selection %P - "%p" in lowercase %q - Hour using 24 hour style %Q - Hour using 12 hour style %r - The same as "%I:%M:%S %p" %R - The same as "%H:%M" %S - The number of seconds with leading zeros %t - Tab %T - The same as "%H:%M:%S" %U - The week number, taking Sunday as the first day of the week %w - The weekday number %W - The week number, taking Monday as the first day of the week %x - The same as "%m/%d/%y" %X - The same as "%H:%M:%S" %y - The year using two digits with leading zeros %Y - The year using four digits with leading zeros
Example:
Ram Disk:> Date LFORMAT="Today is %A." Today is Tuesday.