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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:51:54+00:00 2026-06-09T02:51:54+00:00

I need to parse two Strings in HH:MM format in Java: String time1=10:45; String

  • 0

I need to parse two Strings in HH:MM format in Java:

String time1="10:45";
String time2="02:30";
  • 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-09T02:51:56+00:00Added an answer on June 9, 2026 at 2:51 am

    Stupid but simple:

    String time1 = "10:45";
    String time2 = "02:30";
    
    String[] split1 = time1.split(":");
    String[] split2 = time2.split(":");
    
    int total = 60 * Integer.parseInt(split1[0]) +
                Integer.parseInt(split1[1]) +
                60 * Integer.parseInt(split2[0]) +
                Integer.parseInt(split2[1]);
    
    int hours = total / 60;
    int minutes = total - hours * 60;
    System.out.println(hours + ":" + minutes);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to parse strings like these: kev-+kvs+-one-+gdl+-greg-+kvs+-two-+gdl+-les-+kvs+-three -+gdl+-kev-+kvs+-one-+gdl+-greg-+kvs+-two-+gdl+-les-+kvs+-three kev-+kvs+-one-+gdl+-greg-+kvs+-two-+gdl+-les-+kvs+-three-+gdl+- and
I need to parse a string to two variables according to the following rules,
I need to compare hash values of two strings. I use string template for
Hi I need parse and deserialize pseudo JSON string. Input data: {aBubbleData[ 'jaja2581' ]={
I need to parse a duration string, of the form 98d 01h 23m 45s
I need to parse through a string and add single quotes around each Guid
I need to parse a JSON string in my project, which runs on BB
My application produces strings like the one below. I need to parse values between
I have a string and I need to parse it for a value... var
I need to parse a date from input string using date pattern yyyy-MM-dd, and

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.