element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum How to update date and Time in Raspberry Pi
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 9 replies
  • Answers 2 answers
  • Subscribers 670 subscribers
  • Views 23372 views
  • Users 0 members are here
  • raspberry_pi
Related

How to update date and Time in Raspberry Pi

sameermp
sameermp over 7 years ago

I have purchased a Raspberry Pi 3 model B in August 2017. I am unable to set up Date and Time. Every time I turn on the hardware, It shows date - 12 April  2017.

I have tried setting it up with  Sudo raspi-config but could not do it.

Please guide me on the procedure.

Thanks.

  • Sign in to reply
  • Cancel
Parents
  • gdstew
    0 gdstew over 7 years ago

    Here is an example of the date command which can be used to set the time/date if the Raspberry Pi is not connected to the internet:

     

    #sudo date --set='TZ="America/Chicago" 8 Oct 2017 14:32'

     

    Note that the use of the "nornal" backward ticks after --set= and at the end of the command are required to keep the shell (bash) from

    misinterpreting special characters in the command line.

     

    The time zone (TZ=) will have to be set according to where you are of course and the time is in 24 hour format.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • gdstew
    0 gdstew over 7 years ago

    Here is an example of the date command which can be used to set the time/date if the Raspberry Pi is not connected to the internet:

     

    #sudo date --set='TZ="America/Chicago" 8 Oct 2017 14:32'

     

    Note that the use of the "nornal" backward ticks after --set= and at the end of the command are required to keep the shell (bash) from

    misinterpreting special characters in the command line.

     

    The time zone (TZ=) will have to be set according to where you are of course and the time is in 24 hour format.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • sameermp
    0 sameermp over 7 years ago in reply to gdstew

    My Raspberry Pi is connected to internet via wifi. Even after setting the proper timezone and country, I does not update the time and date.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • adams_l
    0 adams_l over 7 years ago in reply to sameermp

    Maybe your router settings do not like Network Time Protocol (ntp).

     

    To disable ntp and manually update the time instead:

    'sudo update-services ntpd disable'

    and then

    'sudo apt-get install ntpdate'.

     

    Then you can update the date and time manually with

    'sudo ntpdate'

    or you can specify a timeserver like

    'sudo ntpdate pool.ntp.org'

     

    To set the time at boot, add 'ntpdate' to rc.local.

    If you want automatic updates, you could add 'ntpdate' as a cron job.

     

    --WLAJ

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rew
    0 rew over 7 years ago in reply to adams_l

    As far as I know, the raspberry already does the equivalent of

    sudo ntpdate pool.ntp.org

    at boot. That's the "sets the time from the network".

     

    I would suggest that instead of manually entering the time, you try this sudo ntpdate command manually first to see if it works for you. Only when it works is it useful to invest time in making such changes permanent (i.e. happen automatically on the next boot).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 7 years ago in reply to sameermp

    Is the Raspbian ntp package installed?

    Check: dpkg -l ntp

     

    You should see something like this as output:

     

    ii  ntp            1:4.2.8p10+d amd64        Network Time Protocol daemon

     

    If not, do this:

    sudo apt -y install ntp

     

    That will get you network time automatically.  No manual intervention required.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • mikeburch
    0 mikeburch over 4 years ago in reply to Former Member

    This worked perfectly for me using Twister.  Thank you!   Greetings from Arizona.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube