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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:46:44+00:00 2026-06-12T01:46:44+00:00

hello I have date like.. String date=09:00 AM But I need 09:00:00 So I

  • 0

hello I have date like..

String date="09:00 AM"

But I need 09:00:00

So I use following.

 String date="09:00 AM"  
 SimpleDateFormat f1 = new SimpleDateFormat("hh:mm:ss");
 Date d1= f1.parse(date);

But it give me parse exception.

Please help me to find this.

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-06-12T01:46:45+00:00Added an answer on June 12, 2026 at 1:46 am

    That’s not the correct format for parsing that date, you need something like:

    "hh:mm a"
    

    Once you have a date object, you can then use a different format to output it. The following code segment shows how:

    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    String date = "09:27 PM";
    
    SimpleDateFormat h_mm_a   = new SimpleDateFormat("h:mm a");
    SimpleDateFormat hh_mm_ss = new SimpleDateFormat("HH:mm:ss");
    
    try {
        Date d1 = h_mm_a.parse(date);
        System.out.println (hh_mm_ss.format(d1));
    } catch (Exception e) {
        e.printStackTrace();
    }
    

    This outputs:

    21:27:00
    

    as you would expect.

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

Sidebar

Related Questions

Hello I have an unusual date format that I would like to parse into
Hello friends, I have a string like /Date(1312628727617+0000)/ and this regular expression convert into
hello i have just start using Raphael but i'm very confused in the following
Hello I have been trying to format this date but it keeps giving me
I have the following file party.txt that contains something like the following: Hello Jacky
I have a simple Google Apps Script ContentService that emits a string like Hello
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
Hello I have next function, what always return null as result, but service calling
Hello I have a datatable that I would like to filter with a single
Hello I have the following code: if(_deviceSegmentCntrl.selectedSegmentIndex == 0) { deviceOne = [[NSString alloc]

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.