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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:32:13+00:00 2026-05-26T15:32:13+00:00

SimpleDateFormat dateFormat = new SimpleDateFormat(mm/dd/yyyy); Date date = dateFormat.parse(11/04/2011); System.out.println(date); System.out.println(dateFormat.format(date)); Tue Jan 04

  • 0
 SimpleDateFormat dateFormat = new SimpleDateFormat("mm/dd/yyyy");
 Date date = dateFormat.parse("11/04/2011");
 System.out.println(date);
 System.out.println(dateFormat.format(date));

Tue Jan 04 00:11:00 IST 2011
11/04/2011

When output the date object it shows as january instead of november. But when format the same date object it shows november correctly.

By making MM/dd/yyyy it both shows the correct result. But Shouldnt the mm/dd/yyyy throws an Unparseable date exception if mm/dd/yyyy is fishy?

  • 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-05-26T15:32:13+00:00Added an answer on May 26, 2026 at 3:32 pm

    A common error: mm is the pattern for minutes. You want to use MM to parse/print the month. Use MM/dd/yyyy instead of mm/dd/yyyy.

    Since you parse the value 11 into the minute-part of the date and then print the minute-part of the date in the first place, the result of dateFormat.format(date) looks correct.

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

Sidebar

Related Questions

SimpleDateFormat formatter = new SimpleDateFormat(ddMMyyyy_HHmmSS); String strCurrDate = formatter.format(new java.util.Date()); String strfileNm = Cust_Advice_
SimpleDateFormat formatter = new SimpleDateFormat(ddMMyyyy_HHmmSS); String strCurrDate = formatter.format(new java.util.Date()); String strfileNm = Customer_
Why this code doesn't raise a 'ParseException' ? DateFormat formatter = new SimpleDateFormat(dd/mm/yyyy); try
I want to be able to parse this date-time format 2011-12-02T16:18:12.479-05:00 into an mm/dd/yy
I have the following Java: DateFormat formatter = new SimpleDateFormat( EEE MMM dd yyyy
The SimpleDateFormat: SimpleDateFormat pdf = new SimpleDateFormat(MM dd yyyy hh:mm:ss:SSSaa); The exception thrown by
I'm using java.text.SimpleDateFormat to parse string representations of date/time values inside an XML document.
I have a string that contains a date, in the following format: dd-mm-yyyy with
I have a string in the following format. 07/06/2011 5:06 mm/dd/yyyy hh:mm am using
I am trying to parse this date with SimpleDateFormat and it is not working:

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.