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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:08:20+00:00 2026-06-11T06:08:20+00:00

I got time in this format: 192:40 192=Hours, 40 = minutes. Lets say I

  • 0

I got time in this format: “192:40”
192=Hours, 40 = minutes.

Lets say I want to substract “02:30” hours so the answer will be “190:10”..

Is there any way doing it?
Thanks!

  • 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-11T06:08:21+00:00Added an answer on June 11, 2026 at 6:08 am

    Use explode() to separate the hour / minute pieces, then do the math yourself:

    list( $hour, $min) = explode( ':', "192:40");
    list( $hour_sub, $min_sub) = explode( ':', "02:30");
    $result = ($hour - $hour_sub) . ':' . ($min - $min_sub);
    echo $result;
    

    This will print:

    190:10
    

    If the time were to wrap around, ($min - $min_sub) would be negative. To account for this, the following can be used:

    list( $hour, $min) = explode( ':', "192:40");
    list( $hour_sub, $min_sub) = explode( ':', "02:30");
    $hour = $hour - $hour_sub;
    $min  = $min  - $min_sub;
    if( $min < 0) {
        $min = 60 + $min; // Note $min is negative
        $hour--; // Decrement hour
    }
    $result = $hour . ':' . $min;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a String of a date/time in ISO-8601 format, like: 2011-04-15T20:08:18Z I want
So I've got a text input that get's date & time in this format:
This is the first time I got this error. This code basically gets the
I got another problem, this time with tables and their borders in HTML (4.01,
Observed: First, 'ctrl+v'+selection always worked before for me. But this time, i got normal
I've been struggling with this error for quite some time: Redis::ProtocolError: Got 'i' as
I've got this class I found for converting timestamps to X Time Ago. It
I want Perl to display current date and time in the following format: 2010-02-11
I've got a NSDate that represents a specific time. The format of that date
Let's say that i've got a model. This model has data for position, color,

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.