OpenBSD Set Date and Time

by Vivek Gite on April 3, 2008 · 0 comments

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:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 8 + 6 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: