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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:59:10+00:00 2026-06-10T05:59:10+00:00

Calendar c = Calendar.getInstance(); c.set(2019, 12, 29); When i did c.getTime() i got the

  • 0
Calendar c = Calendar.getInstance();
c.set(2019, 12, 29);

When i did c.getTime() i got the following output…

Output:

Wed Jan 29 17:15:27 IST 2020 // Should have been 2019

/////————————————————————-//////

Calendar c = Calendar.getInstance();
c.set(2019, 11, 29);

When i did c.getTime() i got the following output…

Output:

Sun Dec 29 17:18:23 IST 2019

Now i don’t know why changing the Month from 12th to 11th gave me the correct date and time, i would be really obliged if someone can explain this simply and if possible with a small uncomplicated example.

  • 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-10T05:59:11+00:00Added an answer on June 10, 2026 at 5:59 am

    Months in a Calendar are zero-based

    The first month of the year in the Gregorian and Julian calendars is JANUARY which is 0

    Assuming a Gregorian calendar, 11 is December, and 12 is January of next year, precisely the way your program shows it.

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

Sidebar

Related Questions

I have found advice like: Calendar calendar1 = Calendar.getInstance(); Calendar calendar2 = Calendar.getInstance(); calendar1.set(2007,
I tried the following piece of code: Calendar c1 = Calendar.getInstance(); c1.set(Calendar.YEAR, 0); c1.set(Calendar.DAY_OF_YEAR,
I do the following: Calendar c = Calendar.getInstance(TimeZone.getTimeZone(Europe/Berlin)); c.setFirstDayOfWeek(Calendar.MONDAY); c.set(Calendar.DAY_OF_MONTH, 9); c.set(Calendar.MONTH, 3); c.set(Calendar.YEAR,
Calendar calendar = Calendar.getInstance(); calendar.set(calendar.HOUR, 8); calendar.set(calendar.MINUTE, 45); calendar.set(calendar.SECOND, 00); Date d = calendar.getTime();
I am having the following code Calendar calendar = Calendar.getInstance(); calendar.set(2011, 7, 29); //case
I use next code to print current time Calendar cal = Calendar.getInstance(); System.out.println(cal.getTime()); I
Take a look at the piece of code bellow: Calendar today1 = Calendar.getInstance(); today1.set(Calendar.DAY_OF_WEEK,
I need to set alarm in google calendar via Android app. I have successfully
I have the code : public void AlarmStart() { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE,
Consider the following snippet: Calendar futureDate = Calendar.getInstance(); int year = 2011; int month

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.