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

  • Home
  • SEARCH
  • 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 8827329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:20:46+00:00 2026-06-14T07:20:46+00:00

Got a strange weirdness when using Date s and Calendar . Point is I

  • 0

Got a strange weirdness when using Dates and Calendar. Point is I want to create a specific date e.g.

Calendar cal = Calendar.getInstance();
cal.set(1970, 0, 1, 0, 0, 0);
Date date = cal.getTime(); 

Now the thing is: it shows the correct date, but when debugging I see under the date-variable a “fasttime” of e.g. -3599459. This makes my JUnit tests fail, because the expected value is -3600000.
It seems the Calendar adds 541 milliseconds or something like when initializing…

Question is: is it not possible to simply create a fixed date without this ‘i’m adding some milliseconds in the background’-ghost function?

  • 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-14T07:20:48+00:00Added an answer on June 14, 2026 at 7:20 am

    Add this line before calling cal.getTime():

    cal.set(Calendar.MILLISECOND, 0);
    

    This will make sure you set the milliseconds to zero.

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

Sidebar

Related Questions

i got a strange Problem using Jain Sip (dowload today Version Jain-sip-ri-1.2.2014.jar). I'm connecting
I got strange results using NSDataDetector and I am looking for insight in how
I've got strange issue. I want wait end async call at sync function call.
I'm writing custom security attribute and got strange compiler behaviour... When I'm using the
I've again got a strange problem: I'm writing a crawler to index a specific
I tried to use set() of rafael library, got strange behavior of bbox, here
I got strange condition when showing my video using cvShowImage or even when appending
Got really strange Firefox issue. Using the Microsoft __doPostBack javascript function in web forms
got a strange problem: I create a TPanele at runtime and change its color
I got strange rounding issue for VAT in Magento. My product set up is

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.