Description
Convert a supplied clock to a fixed 24-hour day fraction with an end-of-day policy.
Date formats distinguish calendar years from ISO week-years, known day precision from unknown-day masks, and midnight at the start versus end of a day. A fixed 86400-second day fraction does not encode civil timezone transitions. Partial-date wording preserves uncertainty rather than silently choosing a date.
Convert a supplied clock to a fixed 24-hour day fraction with an end-of-day policy.
When to use this tool
Use Civil Day Fraction Midnight Policy when you already have hour, minute, second, allowEndOfDay and need to convert a supplied clock to a fixed 24-hour day fraction with an end-of-day policy.
How to use the tool and how it works
- Enter hour, minute, second, allowEndOfDay. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read dayFraction, nextDayMidnight. Inspect nextDayMidnight before interpreting the associated values.
Require whole hour 0..24, minute 0..59 and seconds in [0,60); hour 24 requires allowEndOfDay=true, minute=0 and second=0. Divide total seconds by 86400 and flag hour 24 as nextDayMidnight.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| hour | Hour | Required. Safe integer; minimum 0; maximum 24. |
| minute | Minute | Required. Safe integer; minimum 0; maximum 59. |
| second | Finite second in [0,60), allowing fractions but excluding leap-second 60. | Required. Finite number; minimum 0; strictly below 60. |
| allowEndOfDay | Allow End Of Day | Required. Boolean. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| dayFraction | Day Fraction | Required. Finite number. |
| nextDayMidnight | True only for permitted 24:00:00; dayFraction=1 without choosing a next calendar date. | Required. Boolean. |
{
"input": {
"hour": 12,
"minute": 0,
"second": 0,
"allowEndOfDay": false
},
"output": {
"dayFraction": 0.5,
"nextDayMidnight": false
}
} Limitations and assumptions
- Fractional seconds are accepted, leap-second 60 rejected. A fraction of one denotes the next midnight without updating a date; real civil-day lengths and daylight-saving changes are not modeled.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use a complete calendar/timezone conversion when relating week dates, timestamps or local schedules. Preserve unknown precision explicitly and choose an endpoint policy before calculation; a formatter or fixed-day fraction does not resolve missing dates or civil-time rules.
References
Similar or alternative tools
- Endocrine Collection Shift Clock Wrap
Shift a supplied collection clock and count crossed daily boundaries.
- Insect Collection Local Time Solar Offset
Shift a supplied local clock by a supplied solar-minus-local offset.