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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:09:39+00:00 2026-06-05T22:09:39+00:00

I have a value like the following Mon Jun 18 00:00:00 IST 2012 and

  • 0

I have a value like the following Mon Jun 18 00:00:00 IST 2012 and I want to convert this to 18/06/2012

How to convert this?

I tried this method

public String toDate(Date date) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        Date theDate = null;
        //String in = date + "/" + month + "/" + year;
        try {
            theDate = dateFormat.parse(date.toString());
            System.out.println("Date parsed = " + dateFormat.format(theDate));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return dateFormat.format(theDate);
    }

but it throws following exception :

java.text.ParseException: Unparseable date: "Mon Jun 18 00:00:00 IST 2012"

  • 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-05T22:09:41+00:00Added an answer on June 5, 2026 at 10:09 pm

    I hope following program will solve your problem

    String dateStr = "Mon Jun 18 00:00:00 IST 2012";
    DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
    Date date = (Date)formatter.parse(dateStr);
    System.out.println(date);        
    
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    String formatedDate = cal.get(Calendar.DATE) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" +         cal.get(Calendar.YEAR);
    System.out.println("formatedDate : " + formatedDate);    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several file with the following format: lat,lon,value. I would like to plot
i have value in php variable like that $var='2.500000550'; echo $var what i want
I have an array with some value like this: [Organization_id] => Array ( [0]
I have an input that holds a date value like so 03/15/2012 I am
I have problem with cakephp's Session->write method. If I set a value like $_SESSION['..']
I have the value of the epoch time like say 123456789, now I want
I have a URL that is like the following: http://www.example.com/client/project/subdirectory/value/ I would like like
I have a simple table like following: class SnookerCurrentInfo extends Doctrine_Record { public function
I have XML with a value like the following: <products> <product id=1 name=All Products>
Suppose I have an array of string like following: str_arr=[10$, 10$ I am a

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.