Unix \ Linux DateCommands
1. Date: This command is used to display the current system date
3. Date Formatting options, to format the date output, we can use "control characters" followed by a + sign. Format controls begin with the % symbol and are substituted by their current values to dispay required date format.
- %D -- Display date as mm/dd/yy
- %Y -- Year (e.g., 2022)
- %m -- Month (01-12)
- %B -- Long month name (e.g., October)
- %b -- Short month name (e.g., Oct)
- %d -- Day of month (e.g., 01)
- %j -- Day of year (001-366)
- %u -- Day of week (1-7)
- %A -- Full weekday name (e.g., Sunday)
- %a -- Short weekday name (e.g., Sun)
- %H -- Hour (00-23)
- %I -- Hour (01-12)
- %M -- Minute (00-59)
- %S -- Second (00-60)
4. Cal: To view calendar of current month
5. Change Linux Server Date:
- It is used to change the system clock manually.
- Please use date --set command.
- For example, to set the date and time to 5:30 PM, May 13, 2010, type:
- date --set="20220514 05:30"
- Note: Manual setting the clock in Linux should not be implemented on production without client approval.
- It is used to change the system clock manually.
- Please use date --set command.
- For example, to set the date and time to 5:30 PM, May 13, 2010, type:
- date --set="20220514 05:30"
- Note: Manual setting the clock in Linux should not be implemented on production without client approval.
6. Display Future/past Dates:
- "--date" option is used to display past dates in Linux.
- It accepts parameter values such as "tomorrow", "Monday", "last Monday", "next Monday", "next week", and similar.
No comments:
Write commentsPlease do not enter spam links