Ubuntu 24.04
Sponsored Link

Command Help

Command :   Back to index

date : print or set the system date and time
[SYNOPSIS] date OPTION
OPTION
  Display current date and time
# date
Fri Nov 3 09:48:26 AM JST 2013
-R Output date and time in RFC 5322 format
# date -R
Fri, 03 Nov 2013 09:50:58 +0900
  Display in specified format
# date "+%Y/%m/%d %H:%M:%S"
2013/11/03 09:56:08
Year  
%Y year
%y last two digits of year
%-y last two digits of year (no zero padding of digits)
Month  
%m 01 - 12
%-m 1 - 12 (no zero padding of digits)
%B January - December
%b Jan - Dec
Day  
%d 01 - 31
%-d 1 - 31 (no zero padding of digits)
%j 001 - 365 (leap years up to 366)
%-j 1 - 365 (leap years up to 366)
Hour  
%H 00 - 23
%-H 0 - 23 (no zero padding of digits)
%I 01 - 12
%-I 1 - 12 (no zero padding of digits)
Minutes  
%M 00 - 59
%-M 0 - 59 (no zero padding of digits)
Seconds  
%S 00 - 59
%-S 0 - 59 (no zero padding of digits)
%s seconds since the Epoch (1970-01-01 00:00 UTC)
%N nanoseconds (000000000..999999999)
Week  
%U week number of year, with Sunday as first day of week (00..53)
Day of Week  
%a Sun - Sat
%A Sunday - Saturday
%u 1 - 7 (1 = Monday)
%w 0 - 6 (0 = Sunday)
-d Display by specifying date and time
# date -d '10 days' "+%Y/%m/%d %H:%M:%S"
2013/11/13 10:02:43
- Display date and time after 10 days
# date -d '5 days ago' "+%Y/%m/%d %H:%M:%S"
2013/10/29 10:03:36
- Display date and time 5 days ago
# date -d '-112 days' "+%Y/%m/%d %H:%M:%S"
2013/07/14 11:19:21
- Display date and time 112 days ago
# date -d 'yesterday' "+%Y/%m/%d %H:%M:%S"
2013/11/02 11:20:28
- Display yesterday's date and time
# date -d 'tomorrow' "+%Y/%m/%d %H:%M:%S"
2013/11/04 11:21:16
- Display tomorrow's date and time
# date -d 'week ago' "+%Y/%m/%d %H:%M:%S"
2013/10/27 11:22:42
- Display date and time from 1 week ago
# date -d '3 month' "+%Y/%m/%d %H:%M:%S"
2014/02/03 11:25:15
- Display date and time 3 months from now
# date -d '2 year 5 month 17 days 7 hour' "+%Y/%m/%d %H:%M:%S"
2016/04/20 18:49:40
- Display date and time 2 years 5 months 17 days 7 hours later
# date -d 'TZ="America/Los_Angeles" next Fri' "+%Y/%m/%d %H:%M:%S"
2013/11/03 16:00:00
- Show date and time for next Friday in US Los_Angeles
# date -d '@1384978767' "+%Y/%m/%d %H:%M:%S"
2013/11/21 05:19:27
- Display date and time in specified UNIX Time
# date -d '20140701' "+%A"
Tuesday
- Display the day of the week for the specified date
-h Show help

मिलान सामग्री