You can use date -R or –rfc-email option to output date and time in RFC 5322 format. Example: Mon, 14 Aug 2006 02:34:56 -0600
You can use date –rfc-3339=FMT option to output date/time in RFC 3339 format. FMT=’date’, ‘seconds’, or ‘ns’ for date and time to the indicated precision. Example: 2006-08-14 02:34:56-06:00
date -R or –rfc-email or –rfc-822 or –rfc-2822 or –rfc-3339 option example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
## default date ## returns Mon Feb 7 11:13:16 IST 2022 ## date -R or --rfc-email option date -R ## returns Mon, 07 Feb 2022 11:13:28 +0530 ## date --rfc-3339=TIMESPEC option # date - Print just the full-date date --rfc-3339=date ## returns 2022-02-07 # seconds - Print the full-date and full-time separated by a space date --rfc-3339=seconds ## returns 2022-02-07 11:13:54+05:30 # ns - Like seconds, but also print nanoseconds date --rfc-3339=ns ## returns 2022-02-07 11:14:03.568741800+05:30 ## date --rfc-822 option date --rfc-822 ## returns Mon, 07 Feb 2022 11:15:16 +0530 ## date --rfc-2822 option date --rfc-2822 ## returns Mon, 07 Feb 2022 11:16:11 +0530 |