Date and time functions
TIMEVALUE
Matches all 6 recorded answers
Recorded: 6 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | TIMEVALUE |
| Bulgarian | TIMEVALUE |
| Czech | ČASHODN |
| Danish | TIDSVÆRDI |
| German | ZEITWERT |
| Greek | TIMEVALUE |
| English (Australia) | TIMEVALUE |
| English (United Kingdom) | TIMEVALUE |
| English (United States) | TIMEVALUE |
| Spanish | HORANUMERO |
| Estonian | TIMEVALUE |
| Finnish | AIKA_ARVO |
| French | TEMPSVAL |
| Hebrew | TIMEVALUE |
| Croatian | TIMEVALUE |
| Hungarian | IDŐÉRTÉK |
| Indonesian | TIMEVALUE |
| Italian | ORARIO.VALORE |
| Japanese | TIMEVALUE |
| Korean | TIMEVALUE |
| Lithuanian | TIMEVALUE |
| Latvian | TIMEVALUE |
| Norwegian | TIDSVERDI |
| Dutch | TIJDWAARDE |
| Polish | CZAS.WARTOŚĆ |
| Portuguese (Brazil) | VALOR.TEMPO |
| Portuguese (Portugal) | VALOR.TEMPO |
| Romanian | TIMEVALUE |
| Russian | ВРЕМЗНАЧ |
| Slovak | TIMEVALUE |
| Slovenian | TIMEVALUE |
| Serbian (Latin) | TIMEVALUE |
| Swedish | TIDVÄRDE |
| Thai | TIMEVALUE |
| Turkish | ZAMANSAYISI |
| Ukrainian | TIMEVALUE |
| Vietnamese | Hàm TIMEVALUE |
| Chinese (Simplified) | TIMEVALUE |
| Chinese (Hong Kong) | TIMEVALUE |
| Chinese (Traditional) | TIMEVALUE |
Names from Microsoft's support site.
What it does
TIMEVALUE(time_text)
TIMEVALUE converts text that reads as a time into the fraction of a day it denotes — the same
kind of value TIME constructs from three numbers, and the fractional counterpart to
what DATEVALUE produces from date text.
It is the exact mirror of DATEVALUE: where DATEVALUE parses the date part of a string and
discards any time, TIMEVALUE parses the time part and discards any date. TIMEVALUE("1/1/2024 13:00") is 13:00 as a fraction, with the date thrown away.
The result is therefore always in [0, 1), and the caveats about representability on TIME apply unchanged: 1/86400 is not exactly representable, so a parsed time is generally a nearby double rather than the exact value.
Arguments
TIMEVALUE(time_text) — one required argument.
time_text — text representing a time, or a reference to a cell containing such text. The
documented examples are of the "6:45 PM" and "18:45" shape.
The misunderstood case is the same one DATEVALUE has: passing a cell that already holds a real
time. A cell holding a time holds a number, and this function exists for text that Excel did not
convert on entry — typically imported or concatenated data.
Try it
Quirks
Result and edge cases
Returns a Number in [0, 1).
- Any date part is discarded, so a full timestamp string yields only its time.
- Values at or above 24 hours have no representation in the result's range. Whether
TIMEVALUE("25:00")errors, wraps to 01:00 (as TIME's documented modulo rule would), or is simply not accepted by the parser is not documented and not checked here. It is the most interesting open question about this function, because the two plausible answers come from two different parts of the system: the parser's grammar and the constructor's arithmetic. - Fractional seconds — whether
"12:00:00.5"parses, and whether the fraction survives, is undocumented and unverified. - Whitespace, AM/PM spelling and separators are part of the same undocumented, locale-scoped
accepted set that
DATEVALUEhas.
Errors
As documented:
#VALUE!whentime_textdoes not represent a valid time.
An error value passed in propagates in the ordinary way. Nothing here overrides the engine rules in coercion and lifting.
How to implement
Notes for implementers
- Locale is an input. A parser with a hard-coded
HH:MM:SSgrammar implements one configuration of this function, not the function. - Decide, and document, the ≥24-hour policy. The
TIMEconstructor's documented modulo rule is a tempting default, butTIMEVALUEis a parser and parsers usually reject rather than wrap. Neither behaviour can be claimed as Excel's without observation. - Preserve the discard rule exactly. Parsing a full timestamp and returning
fracof the whole serial is not the same as parsing the time part, once the date part is out of range or ambiguous. - Do not claim compatibility from an inferred grammar. State the forms accepted; do not state that they are the forms Excel accepts.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
TIMEVALUE · 7 lines · calc-func/src/catalogue/dates.rs on GitHub13 timevalue_fn "TIMEVALUE" (1, 1) [V "time_text"] |s, a, sv| {
let reading = super::text_format::read_value(s, a, 0)?;
match reading {
crate::value_text::Reading::DateTime(serial) => s.number(serial - serial.floor()),
crate::value_text::Reading::Number(_) => fail(W::Value),
}
}
Kernels shared with other functions
read_valuecatalogue/text_formatprofilecatalogue/text_formatrenderedcatalogue/text_formattextcatalogue/text_formatlow32decimalNatural::zerodecimalNatural::from_u64decimalNatural::pow10decimalNatural::normalizedecimalNatural::is_zerodecimalNatural::mul_add_smalldecimalNatural::times_pow10decimalNatural::times_pow5decimalNatural::times_pow2decimalExactDecimal::readdecimalExactDecimal::binarydecimalhas_invalid_exponentformat/datetimelooks_like_datetime_formatformat/datetimewithout_subsecondsformat/datetimerender_with_datetime_tokensformat/datetimetokenize_datetime_formatformat/datetimeelapsed_token_atformat/datetimeclassify_minute_tokensformat/datetimetoken_kindformat/datetimeis_time_neighborformat/datetimepush_literalformat/datetimerender_datetime_literalformat/datetimeformat_elapsedformat/datetimeTimeParts::from_serialformat/datetimemeasured_hostformatcurrency_literalformatdigitsformatfifteenformatsplitformatgroupedformatgeneralformatsignificantformatsectionsformatbracketformatis_conditionformatis_elapsedformatcondition_holdsformatcondition_offormatstrip_tokensformatchooseformatitemsformatnumericformatliteral_textformatinteger_partformatfraction_partformatscientificformatfraction_codeformatFractionCode::renderformatmixed_fraction_under_space_groupingformatconvergentformattext_declared_date_localeformattextformattext_of_textformatmonth_nameformat/namesweekday_nameformat/nameslocale_namesformat/namesLocaleId::from_bcp47_language_taglocaleLocaleId::from_excel_lcidlocaleshort_date_orderlocaleshort_date_patternlocalecurrency_placementlocalecurrency_spacinglocalecurrency_negative_patternlocaleformat_profilelocaledays_from_civillocalecivil_from_dayslocaleymd_from_excel_seriallocaledecimalnumber_textfirst_precisionnumber_textnear_tienumber_textfirst_roundingnumber_textroundednumber_textincrementnumber_textasciinumber_textdays_from_civilported/date_kernelscivil_from_daysported/date_kernelsserial_unbounded_1900ported/date_kernelsymd_1900ported/date_kernelsis_leapported/date_kernelsdays_in_monthported/date_kernelswhole_serialported/date_kernelswholeported/date_kernelsweekday_sunday_one_basedported/date_kernelsremap_weekdayported/date_kernelsweekday_ofported/date_kernelsweekdayported/date_kernelstextported/text_kernelstext_from_strported/text_kernelsdate_integer_floorported/text_kernelspush_singleton_or_originalported/text_kernelspush_upperported/text_kernelsupperported/text_kernelsmeasured_host_readervalue_textmeasured_spacevalue_textreadvalue_textnumbervalue_textdecimalvalue_textfractionvalue_texttokensvalue_textmonth_namedvalue_texttime_atvalue_textfull_yearvalue_textvalid_dayvalue_textthis_yearvalue_textserial_1900value_textdate_ofvalue_textdate_timevalue_text
Argument and result plumbing
failcatalogue/kittext_argcatalogue/kittext_valuecatalogue/kit
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
- DATEVALUE — the mirror.
DATEVALUE(t) + TIMEVALUE(t)is the standard way to turn one timestamp string into one serial, and it works precisely because each function discards what the other keeps. - TIME — the deterministic, locale-free alternative when the components are already numbers. Prefer it wherever the input is not literally text.
- HOUR, MINUTE, SECOND — the decomposition
applied to whatever
TIMEVALUEproduces; a natural round-trip test. - The
VALUEfunction — the general text-to-number conversion, whose accepted set overlaps this one in ways the documentation does not describe.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents