Q. How do I set new date and time under OpenBSD UNIX server?
A. You can set date and time using date command. OpenBSD date command uses following syntax:
date yyyymmddhhss
where,
=> yyyy - Year
=> mm - Month
=> dd - Day
=> HHSS - Hour Second in 24 clock format
WARNING! These examples requires root level privileges (you must login as root).Set the date to April 23, 1979, 4:27 PM, enter:
# date 197904231627
Set the time to 2:32 PM, without modifying the date, enter
# date 1432
To display current date and time, enter date command without option:
$ date
Output:
Sat Apr 3 11:06:51 IST 2008
Display the date using the specified format string:
$ date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S"
Output:
DATE: 2008-05-03 TIME: 11:07:55
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 05/3/08



{ 0 comments… add one now }