How to format date in Linux?

You can use Linux date command with different FORMAT option to format the date in Linux.

Example:

Get date on Linux in default format:

Linux date FORMAT options with examples:

Get only three-letter day name in Linux:

Get only day name in Linux:

Get only three-letter month name in Linux:

Get only month name in Linux:

Get locale date and time in Linux:

Get first two digits of current year in Linux:

Get current day of month in Linux:

Get current date in mm/dd/yy format in Linux:

Get current date in yyyy-mm-dd format in Linux:

Get last two digits of current year in Linux:

Get current hour in 24 hours format in Linux:

Get current hour in 12 hours format in Linux:

Get current day of year in Linux:

Get current month number in Linux:

Get current minute in Linux:

Get current nanoseconds in Linux:

Get current time with am pm in Linux:

Get current hour minute in Linux:

Get current time since epoch in Linux:

Get current seconds in Linux:

Get current day of week in number in Linux:

Get current week number of year in Linux:

Get current year in Linux:

Get current date with timezone in Linux:

Leave a Reply