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

  • Home
  • SEARCH
  • 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 5938597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:42:31+00:00 2026-05-22T15:42:31+00:00

I am getting a date in this format: 2011-05-23 6:05:00 How can I obtain

  • 0

I am getting a date in this format:

2011-05-23 6:05:00

How can I obtain only 2011-05-23 from this string?

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

    Here you go:

    import java.*;
    import java.util.*;
    import java.text.*;
    
    public class StringApp {
        public static void main(String[] args)
        {
            String oldDate = "2011-05-23 6:05:00";
            String dateFormat = "yyyy-MM-dd";
            try {
                SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
                Calendar cl = Calendar.getInstance();
                cl.setTime(sdf.parse(oldDate));
                String newDate = sdf.format(cl.getTime());
                System.out.println(newDate);
            } 
            catch (ParseException ex) { 
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My date string that I am getting is 8/5/2011 1:38:13 PM of this format.
I'm parsing this date format from XML:=> 2011-12-06T07:41:14.016+00:00 , and I'm getting this error:
I'm getting a date from a Web Service, dd/mm/yyyy hh:mi:ss. Like this: 10/10/2011 12:00:00
I am getting date in 2011-10-01T21:00:00.0000000-07:00 format from the server. I have tried to
In my project i am getting 2008-02-01T10:03:23.793-06:00 this date format in string i have
I am getting the date string from the server as 2012-06-21 18:13:33 -04:00 What
I have this date format , var dateobj = 'Apr 28, 2011 6:01:23 AM';
Hi I have a date format like this (in English format) 15. July 2011
I've string (variable is fileDate ) with Date values in the following format: 2/12/2011
I'm having a problem getting the right date format to be returned from my

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.