How to extract the time from a date and time in Excel
Formula (Excel and Google Sheets)
=MOD(A2,1)Keep the fraction of the day: =MOD(A2,1), formatted as a time.
- Result on the example
- one result per row in
B2, filled down toB6 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.
How it works
A date and time is a whole number of days plus a fraction for the time. MOD(A2,1) keeps the remainder after dividing by 1, which is the fraction: the time of day. Format the result as a time to see it.
=MOD(A2,1)Result0.34375
A23/2/2026 8:15The value in A2.
MOD(A2,1)0.34375MOD: Remainder after division.- number
A23/2/2026 8:15 - divisor
1
- number
In Google Sheets
The same formula works in Google Sheets: =MOD(A2,1). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =A2-INT(A2) | 8:15 AM, 5:40 PM, 12:05 AM… | Subtracts the date part; the same result. |
| =TEXT(A2,"h:mm AM/PM") | 8:15 AM, 5:40 PM, 12:05 AM…Different result | The time as text. Text. |
Common mistakes
- The result is a fraction like 0.34 until you format it as a time.
- For text timestamps, TIMEVALUE returns the time part:
=TIMEVALUE(A2).
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Extract the time from a date and time
B2, return just the time of the timestamp in A2, and fill down to B6.Questions
How do I get just the date?
=INT(A2).
How do I count timestamps before noon?
=SUMPRODUCT(--(MOD(A2:A6,1)<0.5)).
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.