Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 153665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:50:29+00:00 2026-05-11T09:50:29+00:00

I am using jQuery and I need to get the local time for Germany.

  • 0

I am using jQuery and I need to get the local time for Germany.

Anyone coming to my website from any country should be able to know what time it is in Germany.

If the time is between 0:00 and 12:00 I need to make an alert reading: ‘Good Morning’.

If the time is between 12:00 and 17:00 I need to make an alert reading: ‘Good Afternoon’.

How can I implement this in jQuery?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:50:29+00:00Added an answer on May 11, 2026 at 9:50 am

    You can get the local timezone offset of the client to get the GMT time and then add the offset hours of the Germany timezone (Central European Time GMT+1):

    function getDate(offset){   var now = new Date();   var hour = 60*60*1000;   var min = 60*1000;   return new Date(now.getTime() + (now.getTimezoneOffset() * min) + (offset * hour)); }  //...  var dateCET = getDate(1); // Central European Time is GMT +1  if (dateCET.getHours() < 12) {     alert ('Good morning.'); } else {     alert ('Good afternoon.'); } 

    Update: I agree with @Josh, the above code is completely client dependent. Let’s try to do it better:

    $(document).ready(function(){   var timezone = 'Europe/Berlin';   $.getJSON('http://json-time.appspot.com/time.json?tz='+timezone+'&callback=?',     function(data){       if (data.hour < 12) {         alert ('Good morning in '+timezone);       } else {         alert ('Good afternoon in '+timezone);       }     }) }); 

    We are now taking advantage of JSONP to do Cross-Domain requests to the jsontime server, this server exposes a complete JSON API to query time and timezone information.

    You can play with the code here and you can explore the JSONP API here.

    Hurray!, no server-side code!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 158k
  • Answers 158k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is indeed an O(n2n) dynamic-programming algorithm for finding Hamiltonian… May 12, 2026 at 11:15 am
  • Editorial Team
    Editorial Team added an answer When you say "is:empty" do you mean $([selector]).is(":empty") ? It's… May 12, 2026 at 11:15 am
  • Editorial Team
    Editorial Team added an answer Use NSDateFormatter, but set the style (not the format) so… May 12, 2026 at 11:15 am

Related Questions

I am new to jQuery and I am using ajax request to get an
I am using jQuery to grab results from a webservice(3rd party can't change). A
I want to show a pop-up on click of a button. The pop-up should
I have the following script element in my web page: <script src=default.js type=text/javascript></script> Using

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.