FreeBSD Set Date Time and Timezone

How do I setup date and time under FreeBSD operating system using a shell prompt?

Under FreeBSD you can use date command to display or set date and time. The date command displays the date and time read from the kernel clock. If you just type date command without any options (read as without arguments) the date command display the current date and time only.

Please note that if you are looking Linux specific date command faq, please read this FAQ.

FreeBSD Display todays date

Type date command as follows, to display todays date and time:
$ date

Thu Feb  9 23:43:19 IST 2006

FreeBSD set date and time

Only the superuser or root user may set the date under FreeBSD. General format of date command is as follows:
date yymmddhhmmss

  • yy : Year in two digit
  • mm : Month (1-12)
  • dd : Day (1-31)
  • hh : Hours (0..23)
  • mm : Minutes (0..59)
  • ss : Seconds (0..61)

For example following command set date to 12-Jan-2004, 4:27 PM (remember you must be a root user to set date and time)
# date 0401121627

Mon Jan 12 16:27:00 IST 2004

FreeBSD Set Time Without Modifying The Date

Type the following command to sets the time to 4:30 PM:
# date 1630

FreeBSD Setup Timezone

To setup corrct timezone you need to copy your timezone file from /usr/share/zoneinfo directory to /etc/localtime file. Just goto directory:
# cd /usr/share/zoneinfo

Use ls -l command to find out your zonefile.
# ls -l

For example I am in Asia/Culcatta (IST time zone) so I need to copy file as follows:
# cp /usr/share/zoneinfo/Asia/Calcutta /etc/localtime

date command and use of environment variable

You can also use TZ environment variable to display date and time according to your timezone. For example to display the current time in California you need to export TZ as follows (assuming that you are using bash shell):
# date


Fri Feb 10 00:39:59 IST 2006

Now use TZ variable:
# export TZ=America/Los_Angeles
# date


Thu Feb 9 11:10:08 PST 2006

See also:

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
20 comments… add one
  • JaY Oct 2, 2006 @ 6:39

    Good Site.. Keep Up the Good Work. Just wanted to point out that you may confuse a noob by showing this example since you put mm at the end of your sample but in your key you list ss as the second. Probly should tell them its the minute.. Just a FYI I know how it is.. nix people jot things down so fast that they don’t even notice it..

    date yymmddhhmm

    yy : Year in two digit
    mm : Month (1-12)
    dd : Day (1-31)
    hh : Hours (0..23)
    ss : Seconds

    For the new person that didn’t know at the end of the string its the minute .. even though it looks like it asks for the month in this example.


  • 🐧 nixCraft Oct 2, 2006 @ 6:59


    It was typo. The correct syntax is as follows (updated):
    date yymmddhhss

    Appreciate your post.

  • Gooofy Oct 12, 2006 @ 17:39

    That conflicts with the format posted here

    date mmddhhmmyy

  • 🐧 nixCraft Oct 12, 2006 @ 20:15


    This FAQ is about FreeBSD and not about Linux. So the command format is correct and it only works with FreeBSD. Linux specific information:

  • Paul Oct 31, 2006 @ 7:11

    Your site was really of much help to me. Thanks a million.

  • Charles Feb 14, 2007 @ 20:00

    I did major screwup on production server wanting to paste a date change command to a test machine.

    just be careful when you test daylight savings, and make sure you do it on a “test” machine not on your NTP server :)

  • Otuyelu Jun 11, 2007 @ 7:55

    While on a FreeBSD system tried using the Linux format to no avail, before running to google where i found your post.

    Thanks for posting, a real help

  • Chater Aug 24, 2008 @ 9:24

    Very big thanks.
    It’s very useful. I was seek this info on many of russian sites, but only your blog is help me :)
    So thanxxx again

  • Richard Dec 4, 2008 @ 4:53

    You should correct the format it isn’t

    “date yymmddhhSS”

    it is

    “date yymmddhhMM”

    The last two digits will be the minutes, not the seconds.

  • matt Jun 12, 2009 @ 12:31


    The key is the period before “.ss”

  • shake.chen Dec 13, 2009 @ 8:20

    in linux , I can use

    date -R

    I can check the time zone, how to do in freebsd?

    • 🐧 nixCraft Dec 13, 2009 @ 8:45

      ls -l /etc/localtime
      OR note down filesize
      ls -l /etc/localtime
      cd /usr/share/timezone
      find . | grep filesize

  • shaffy Aug 2, 2010 @ 9:55

    its really useful.

  • Tony Acost Jan 28, 2011 @ 17:19

    This is excellent, i was wondering how to get my clock with the right time. Thanks to this I was able to copy my zoneinfo file into /etc/localtime. Thank you

  • X. Benedict Mar 15, 2011 @ 10:14

    I prefer

    ln -s /usr/share/zoneinfo/Australia/Sydney /etc/localtime (for FreeBSD)

    rather than copying the file. That way when all the timezone data gets updated, you don’t have to copy it again.

  • Pétur Ingi Egilsson Apr 30, 2011 @ 12:21

    Thanks, very useful.

  • Finn Espen Gundersen Jun 4, 2012 @ 13:25

    Note that Matt’s format is correct, you need to change the blog post to show a dot before ss or FreeBSD (tested on 9.0) will give error “nonexistent time”.

  • Dave Jul 30, 2012 @ 4:03

    Note that cron will continue to use the old system time zone until you restart it:

    # service cron restart
  • Leander Feb 16, 2014 @ 23:14
    get_current_timzone() {
     CURRENT_TIMEZONE="$(md5 /etc/localtime | awk '{print $4}')"
     find /usr/share/zoneinfo | while read LINE; do FOUND_TIMEZONE="$(md5 ${LINE} | awk '{print $4}')" if [ "${CURRENT_TIMEZONE}" == "${FOUND_TIMEZONE}" ]; then echo ${LINE} | sed -E 's|/usr/share/zoneinfo/||' fi done
    root@Host-10 [~]$ get_current_timzone
  • l2f Mar 29, 2014 @ 16:50


    After copying your timezone file to /etc/localtime do not forgot to run “adjkerntz -a” (man adjkerntz)



Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @