Following are different ways of displaying the current date and time in various formats.
Method 1:
root@vps10634 [~]# date
Mon Sep 2 10:06:33 ICT 2013
Method 2:
root@vps10634 [~]# date --date="now"
Mon Sep 2 10:07:02 ICT 2013
Method 3:
root@vps10634 [~]# date --date="today"
Mon Sep 2 10:07:20 ICT 2013
Method 4:
root@vps10634 [~]# date --date='1970-01-01 00:00:01 UTC +5 hours' +%s
18001
Method 5:
root@vps10634 [~]# date '+Current Date: %m/%d/%y%nCurrent Time:%H:%M:%S'
Current Date: 09/02/13
Current Time:10:08:01
Method 6:
root@vps10634 [~]# date +"%d-%m-%Y"
02-09-2013
Method 7:
root@vps10634 [~]# date +"%d/%m/%Y"
02/09/2013
Method 8:
root@vps10634 [~]# date +"%A,%B %d %Y"
Monday,September 02 2013
Note:
Following are the different format options you can pass to the date command:
- %D date (mm/dd/yy)
- %d day of month (01..31)
- %m month (01..12)
- %y last two digits of year (00..99)
- %a locale’s abbreviated weekday name (Sun..Sat)
- %A locale’s full weekday name, variable length (Sunday..Saturday)
- %b locale’s abbreviated month name (Jan..Dec)
- %B locale’s full month name, variable length (January..December)
- %H hour (00..23)
- %I hour (01..12)
- %Y year (1970…)
L internaute magasine le signe
ReplyDeleteAlso visit my web site; voyance par telephone gratuit, www.londonsuccessuniversity.com,