SEARCH

How-To Geek

Set the Date and Time on Solaris

Setting the system date and time is fairly easy on solaris. Because you can easily set the time from the command line, you can set the time on a server remotely.

date mmddhhmmyy

The date command takes the syntax mmddhhmmyy, or “month day hour minute year”. You have to be superuser to set the time.

Example:

# date 1201010106
Fri Dec  1 01:01:00 PST 2006

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 12/1/06

Comments (5)

  1. Mohammed Yacoob

    Hi,

    The Unix file system format conatains small shell batches– Where the date time will be formated as like numarical values ” expr `date +%Y%m%d` + 1 ”

    Thanks,
    Md Yacoob

  2. Toby Donald

    Hi,

    I have a very strange problem in Solaris 10.

    I can set the time etc either by the above method or by ntpdate SERVERNAME ETC however after a re-boot the server flicks the time forward 1 hour.

    We have a hybrid environment and the server needs to talk to my Server 2008 DC for Sun Ray authentication and with the problem the sun ray admin tool is unable to locate the AD

    Only temp fix so far is too put the DC clock 1 hour forward but obv this cannot be done.

    Any ideas?

    Cheers,
    Toby

  3. shin

    setp1. use this command to get the referance time
    date +%m%d%H%M%y.%S

    setp2. after the step1 command, you will get a string response X from server.
    use date X to set the server time.

    example.
    Last login: Fri Jul 30 17:29:41 from 10.80.9.138
    Sun Microsystems Inc. SunOS 5.9 Generic May 2002
    You have new mail.
    # date +%m%d%H%M%y.%S
    0730173010.32
    # date 0730173010.32
    Fri Jul 30 17:30:32 CST 2010
    #

  4. nevelis

    I think this is a bad example, you should’ve used a different value for the month/hour/minutes because 1201010106 all looks the same.

    shin’s example is better.

  5. ram

    Thanks shin…

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!