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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:04:28+00:00 2026-05-27T15:04:28+00:00

I have a date format as Nov 10,1980 in a string format(String str=Nov 10,

  • 0

I have a date format as “Nov 10,1980″ in a string format(String str=”Nov 10, 1980”), and i want to convert it to 1980-11-10. can any one tell me how to do that using java.

Thanks in advance

  • 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-27T15:04:28+00:00Added an answer on May 27, 2026 at 3:04 pm

    You should first parse it from the original text format, then format the result using the format you want it to end up as. You can use SimpleDateFormat for this, or Joda Time (which is generally a much better date/time API).

    Sample code using SimpleDateFormat:

    import java.text.*;
    import java.util.*;
    
    public class Test {
    
        public static void main(String[] args) throws Exception {        
            String inputText = "Nov 10,1980";
    
            TimeZone utc = TimeZone.getTimeZone("UTC");
    
            // Or dd instead of d - it depends whether you'd use "Nov 08,1980"
            // or "Nov 8,1980" etc.
            SimpleDateFormat inputFormat = new SimpleDateFormat("MMM d,yyyy",
                                                                Locale.US);
            inputFormat.setTimeZone(utc);
    
            SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd",
                                                                 Locale.US);
            outputFormat.setTimeZone(utc);
    
            Date parsed = inputFormat.parse(inputText);
            String outputText = outputFormat.format(parsed);
    
            System.out.println(outputText); // 1980-11-10
        }
    }
    

    Note that:

    • I’ve explicitly specified the locale to use; otherwise if you try to parse the text on a system with (say) a French default locale, it will try to parse it using French month names.
    • I’ve explicitly set the time zone as UTC to avoid any daylight saving time issues (where a particular value could be ambiguous or even non-existent in the default time zone)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Date format: 2009-08-10T16:03:03Z that I want to convert to: @MMM dd,
I have a date string that looks like the following javascript format. I want
I have string Tue Nov 12 2010,I want to parse it in java.util.Date object.
I have a date format like this 2011-07-29T08:18:39 I want to convert this date
I have a problem that I have Date String in the format 2011-09-28T10:33:53.694+0000. I
Possible Duplicate: Convert one date format into another in PHP I have a date
I have a date and I would like to format the date like that:
I have been given a specification that requires the ISO 8601 date format, does
I have a string containing a date, and another string containing the date format
I have date in this format 2011-11-02 . From this date, how can we

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.