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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:35:20+00:00 2026-05-27T13:35:20+00:00

I am getting date into string in YYYY/MM/DD HH:MM:SS format.I want to change it

  • 0

I am getting date into string in YYYY/MM/DD HH:MM:SS format.I want to change it into the mm/dd/yyyy HH:mm:ss and also it will show AM and PM how can I do this.please help me

Thank you

  • 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-27T13:35:21+00:00Added an answer on May 27, 2026 at 1:35 pm

    To get AM PM and 12 hour date format use hh:mm:ss a as string formatter WHERE hh is for 12 hour format and a is for AM PM format.

    Note: HH is for 24 hour and hh is for 12 hour date format

    SimpleDateFormat formatter = new SimpleDateFormat("mm/dd/yyyy hh:mm:ss a");
                String newFormat = formatter.format(testDate);
    

    Example

    String date = "2011/11/12 16:05:06";
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/mm/dd HH:MM:SS");
            Date testDate = null;
            try {
                testDate = sdf.parse(date);
            }catch(Exception ex){
                ex.printStackTrace();
            }
            SimpleDateFormat formatter = new SimpleDateFormat("mm/dd/yyyy hh:mm:ss a");
            String newFormat = formatter.format(testDate);
            System.out.println(".....Date..."+newFormat);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my project i am getting 2008-02-01T10:03:23.793-06:00 this date format in string i have
I'm getting a date from a Web Service, dd/mm/yyyy hh:mi:ss. Like this: 10/10/2011 12:00:00
I having a problem converting a string into the date format I need. An
I have Date in this format (2012-11-17T00:00:00.000-05:00). I need to convert the date into
I am converting a string into a date object with this code. NSDateFormatter *formate
I am converting hex-string into a dateformat... I am getting wrong date time with
I'm trying to remember the syntax to change a date field into a string.
I am getting the date string from the server as 2012-06-21 18:13:33 -04:00 What
For PDT, I would want -0700. I'm getting a date in the past to
I am getting an error in converting string to date in C#. The error

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.