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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:41:44+00:00 2026-06-03T22:41:44+00:00

Edit: Thanks- I understand it a lot more now. Its very confusing when you

  • 0

Edit: Thanks- I understand it a lot more now. Its very confusing when you first start! Thanks for the help. I am going to keep the question up as is ( in peril of more downvotes) as it might help others. There are some other libraries that everyone seems to recommend for date time


I am struggling with the Java calendar function- its seems to be returning wrong data the bottom figure should be a thursday according to calendar, but is returning as a saturday!

Calendar cal = new GregorianCalendar();
       cal.set(2012,2,23); // 0 = January

      String weekdays[]={"sunday","monday", "tuesday", "wednesday","thursday","friday","saturday",};

        Integer Weekdaycurrent1=cal.get(Calendar.DAY_OF_WEEK);
        System.out.println("today is a "+weekdays[Weekdaycurrent1]); //Prints today is Saturday, when it should be a thursday
  • 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-03T22:41:46+00:00Added an answer on June 3, 2026 at 10:41 pm

    For starters, DAY_OF_WEEK is 1 based:

    public final static int SUNDAY = 1;
    

    Secondly, 2012-03-23 (yes, Mar not Feb) as set by cal.set(2012, 2, 23) was a Friday

    Your code is behaving correctly.

    Edited: For those too lame to read the question properly, calling cal.set(2012,2,23) sets the date to 2012-03-23, because the month parameter is zero-based (ie Jan = 0, Feb = 1, Mar = 2, etc)

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

Sidebar

Related Questions

EDIT: SOLVED Thanks Brooks. Your question led me to keep digging into if the
i am very new to C#, and this is my first question, please be
EDIT: Thanks guys, got it! appears that the explode() function was called from the
Why new()/delete() is slower than malloc()/free()? EDIT: Thanks for the answers so far. Please
Please let me know if you have any idea about it. Thanks EDIT What
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
EDIT: I have fixed all but two warnings now, so thank you all for
I have one paragraph of javascript code. And i don't understand it very well.
Edit: I made a demo apk, so you can understand what I mean: http://cl.ly/3g0s1p030j243y0p3m2F
I understand there are many questions related to this, so I'll be very specific.

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.