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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:32:34+00:00 2026-05-26T21:32:34+00:00

I have String time=02:30 PM means 12 hour format and i want to convert

  • 0

I have String time="02:30 PM" means 12 hour format and i want to convert this time in 24 hour format .

I want this o/p: 14:30. so how can i convert this ?

  • 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-26T21:32:35+00:00Added an answer on May 26, 2026 at 9:32 pm

    I don’t know anything about berries, but in case the API is missing a proper formatting function, you can always get your hands dirty with the string itself:

    static String convert(String time){
    
        boolean pm = "PM".equals(time.substring(6).toUpperCase());
        int h = Integer.valueOf(time.substring(0,2));
    
        if (h!=12)
            h+=pm?12:0;
        else
            h=pm?h:0;
        return ((h<10)?"0":"")+h + ":" + time.substring(3,5);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have string like this /c SomeText\MoreText Some Text\More Text\Lol SomeText I want to
I have a service that give me a date time string in the following
How do I check for time for between. suppose I have Time in string
If I have an immutable string is the hashing algorithm run every time I
I have a RichTextBox that I write a string to every time I click
I have string that I want to chop to array of substrings of given
can any body have idea for create dynamic class at run time.i have one
I have a class, this class can be empty. This class has only public
I have coded a simple PHP Countdown Timer using this code: list($date,$time)=explode( ,$compounddate); list($thour,$tminute,$tsecond)=explode(:,$time);
I have the following date: 2011-08-12T20:17:46.384Z . What format is this? I'm trying to

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.