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 9037269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:12:28+00:00 2026-06-16T09:12:28+00:00

Basically i have built an appointment scheduler webapp using java servlets. It relies heavily

  • 0

Basically i have built an appointment scheduler webapp using java servlets.
It relies heavily on javas Calendar.
The whole thing was developed on my macbook running mountain lion with jdk 1.6.

Now when testing it on my pc i have had some strange results.

Running:

   System.out.println("selected = "+selected);
   Calendar now  = Calendar.getInstance();
        System.out.println("a "+now.getTime());
    now.setTimeInMillis(selected);
        System.out.println("b "+now.getTime());

    now.set(Calendar.MILLISECOND,0);
    now.set(Calendar.SECOND,0);
    now.set(Calendar.MINUTE,0);
    now.set(Calendar.HOUR_OF_DAY,6);//start from 6am
        System.out.println("d "+now.getTime());

    now.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        System.out.println("e "+now.getTime());

on the PC will output:

    selected = 1355835600000
    a Wed Dec 19 19:35:36 EST 2012
    b Wed Dec 19 00:00:00 EST 2012
    d Wed Dec 19 06:00:00 EST 2012
    e Sun Dec 23 06:00:00 EST 2012

Yet on the mac it will output:

    selected = 1355835600000
    a Wed Dec 19 19:33:57 EST 2012
    b Wed Dec 19 00:00:00 EST 2012
    d Wed Dec 19 06:00:00 EST 2012
    e Sun Dec 16 06:00:00 EST 2012

As we can see here, if i build a table representing a weekly schedule off these values, the mac will start at 6am on the sunday contained in the current week.
But the pc will start at 6am on the sunday contained in the next week.

Which means any appointments i create are out of sync on the pc (different days to whats expected)
note: the pc has been tested with both jdk1.6 and jdk1.7

Does anyone know any solutions or reasons behind this?

Thanks

  • 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. Editorial Team
    Editorial Team
    2026-06-16T09:12:30+00:00Added an answer on June 16, 2026 at 9:12 am

    Possibly, this is a locale/timezone problem which might differ on both machines.
    Make sure that both instances use the same locale by hard coding it for example:

    Calendar.getInstance(Locale.US);
    

    else getInstance() would use the default locale of your system.

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

Sidebar

Related Questions

So, I have this desktop app built using WPF and C#. It's basically an
I have currently built basically a copy of Windows explorer using Silverlight 4, to
I have built a two-player tic tac toe game in Java, using sockets (no
I have built a table which is basically done by HorizontalScrollView inside a ScrollView
I have been using UIViewController s and initWithNibName with much success, basically using them
I'm using ASP.NET MVC2 RC and I have built security on top of the
I have built a 'dynamic' site. Basically, there is a configuration database, where users
I have built a LWUIT UI class which contains the Midlet. I am basically
I have built a very simple CakePHP website using the Auth component and have
I have built an executable shell that using MEF loads assemblies (MEF Parts) and

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.