About Linux FAQ

Browse More FAQs:

OpenBSD Set Date and Time

Posted by Vivek on Thursday April 3, 08 @10:32 am

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

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Linux / UNIX FAQ:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , , ~ Last updated on: May 3, 2008

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.