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

  • Home
  • SEARCH
  • 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 50325
In Process

The Archive Base Latest Questions

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

This is the one thing I could never get to work. My problem is

  • 0

This is the one thing I could never get to work.
My problem is to detect the end of one day and the start of the next and then splitting the diff into each day.

Imagine you want to calculate a pay rate but it has to span across midnight.

It also applies to calculating time to run on timed system, or time diff it should’ve run.

  • 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. 2026-05-10T16:34:33+00:00Added an answer on May 10, 2026 at 4:34 pm

    This is obviously a trivial problem in systems where the starting and ending times are data structures that contain both date and time. But there are plenty of systems that don’t do this. It’s very common for timekeeping systems to have a single record that contains a date, a start time, and an end time. In this case, the problem is less trivial.

    There are, I think, two questions you’re asking:

    1. How can I tell if a time span crosses midnight?
    2. If a time span crosses midnight, how much of the time happened on the first day, and how much on the second?

    The first question is easily answered: if the end time is before the start time, the time span has crossed midnight.

    If this is the case, then you have two amounts to calculate. The amount of the time span that occurred on the date is the time between the start time and midnight. The amount of the time span that occurred on the next date is the time between midnight and the end time (i.e. just the end time).

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

Sidebar

Ask A Question

Stats

  • Questions 239k
  • Answers 239k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer XML-RPC is part of the Python standard library: Python 2:… May 13, 2026 at 6:57 am
  • Editorial Team
    Editorial Team added an answer First define the following: #ifdef _M_IX86 typedef unsigned int READETYPE;… May 13, 2026 at 6:57 am
  • Editorial Team
    Editorial Team added an answer I'm not sure a regular expression is the best way… May 13, 2026 at 6:57 am

Related Questions

Ok, this is another one in the theory realm for the CS guys around.
There's no strongly typed View() method to return an ActionResult. So, suppose I have
Here's the thing... I've been working on this issue for a long time now
I am trying to figure out the proper way to use NSManagedObjectContexts when you

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.