[#BloombergLP-bdlt-TimeUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::TimeUtil :relfileprefix: ../../ :mrdocs: This `struct` provides a namespace for common non‐primitive procedures that operate on `Time` objects. These methods are alias‐safe and exception‐neutral. == Synopsis Declared in `<bdlt_timeutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct TimeUtil; ---- == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlt/TimeUtil/convertFromHHMM.adoc[`convertFromHHMM`] | Return the `bdlt::Time` value corresponding to the specified `timeValue`, where `timeValue` is a non‐negative integer that, when expressed in decimal notation, contains exactly four digits (counting leading zeros, if any): two digits for the hour and two digits for the minute. For example, 309 is converted to `Time(3, 9)` (03:09:00.000). More formally, `timeValue` is interpreted as: ` hour * 100 + minute ` The behavior is undefined unless `timeValue` represents a valid time in the allowable range for `bdlt::Time` (00:00:00.000 ‐ 23:59:00.000, and 24:00:00.000). | xref:BloombergLP/bdlt/TimeUtil/convertFromHHMMSS.adoc[`convertFromHHMMSS`] | Return the `bdlt::Time` value corresponding to the specified `timeValue`, where `timeValue` is a non‐negative integer that, when expressed in decimal notation, contains exactly six digits (counting leading zeros, if any): two digits for the hour, two digits for the minute, and two digits for the second. For example, 30907 is converted to `Time(3, 9, 7)` (03:09:07.000). More formally, `timeValue` is interpreted as: ` hour * 10000 + minute * 100 + second ` The behavior is undefined unless `timeValue` represents a valid time in the allowable range for `bdlt::Time` (00:00:00.000 ‐ 23:59:59.000, and 24:00:00.000). | xref:BloombergLP/bdlt/TimeUtil/convertFromHHMMSSmmm.adoc[`convertFromHHMMSSmmm`] | Return the `bdlt::Time` value corresponding to the specified `timeValue`, where `timeValue` is a non‐negative integer that, when expressed in decimal notation, contains exactly nine digits (counting leading zeros, if any): two digits for the hour, two digits for the minute, two digits for the second, and three digits for the millisecond. For example, 30907056 is converted to `Time(3, 9, 7, 56)` (03:09:07.056). More formally, `timeValue` is interpreted as: ` hour * 10000000 + minute * 100000 + second * 1000 + millisecond ` The behavior is undefined unless `timeValue` represents a valid time in the allowable range for `bdlt::Time` (00:00:00.000 ‐ 23:59:59.999, and 24:00:00.000). | xref:BloombergLP/bdlt/TimeUtil/convertToHHMM.adoc[`convertToHHMM`] | Return the non‐negative integer representing the same time as the specified `value` that, when expressed in decimal notation, contains exactly four digits (counting leading zeros, if any): two digits for the hour and two digits for the minute. For example, `Time(3, 9, sec, ms)`, where `0 <= sec < 60` and `0 <= ms < 1000`, is converted to 309. More formally, this method returns: ` value.hour() * 100 + value.minute() ` | xref:BloombergLP/bdlt/TimeUtil/convertToHHMMSS.adoc[`convertToHHMMSS`] | Return the non‐negative integer representing the same time as the specified `value` that, when expressed in decimal notation, contains exactly six digits (counting leading zeros, if any): two digits for the hour, two digits for the minute, and two digits for the second. For example, `Time(3, 9, 7, ms)`, where `0 <= ms < 1000`, is converted to 30907. More formally, this method returns: ` value.hour() * 10000 + value.minute() * 100 + value.second() ` | xref:BloombergLP/bdlt/TimeUtil/convertToHHMMSSmmm.adoc[`convertToHHMMSSmmm`] | Return the non‐negative integer representing the same time as the specified `value` that, when expressed in decimal notation, contains exactly nine digits (counting leading zeros, if any): two digits for the hour, two digits for the minute, two digits for the second, and three digits for the millisecond. For example, `Time(3, 9, 7, 56)` is converted to 30907056. More formally, this method returns: ` value.hour() * 10000000 + value.minute() * 100000 + value.second() * 1000 + value.millisecond() ` | xref:BloombergLP/bdlt/TimeUtil/fromHms.adoc[`fromHms`] | Return an `optional` having a `Time` with the specified `hour`, `minute`, `second`, and the optionally specified `millisecond` and `microsecond`, if those form a valid `Time` (see `Time::isValid`); otherwise return an `optional` without a value. | xref:BloombergLP/bdlt/TimeUtil/isValidHHMM.adoc[`isValidHHMM`] | Return `true` if the specified `timeValue` is a non‐negative integer that represents a valid four‐digit time value suitable for passing to `convertFromHHMM`, and `false` otherwise. `timeValue` is a valid four‐digit time value if, when expressed in decimal notation, it contains exactly four digits (counting leading zeros, if any): two digits for the hour and two digits for the minute, where either `0 <= hour < 24` and `0 <= minute < 60`, or `2400 == timeValue`. | xref:BloombergLP/bdlt/TimeUtil/isValidHHMMSS.adoc[`isValidHHMMSS`] | Return `true` if the specified `timeValue` is a non‐negative integer that represents a valid six‐digit time value suitable for passing to `convertFromHHMMSS`, and `false` otherwise. `timeValue` is a valid six‐digit time value if, when expressed in decimal notation, it contains exactly six digits (counting leading zeros, if any): two digits for the hour, two digits for the minute, and two digits for the second, where either `0 <= hour < 24`, `0 <= minute < 60`, and `0 <= second < 60`, or `240000 == timeValue`. | xref:BloombergLP/bdlt/TimeUtil/isValidHHMMSSmmm.adoc[`isValidHHMMSSmmm`] | Return `true` if the specified `timeValue` is a non‐negative integer that represents a valid nine‐digit time value suitable for passing to `convertFromHHMMSSmmm`, and `false` otherwise. `timeValue` is a valid nine‐digit time value if, when expressed in decimal notation, it contains exactly nine digits (counting leading zeros, if any): two digits for the hour, two digits for the minute, two digits for the second, and three digits for the millisecond, where either `0 <= hour < 24`, `0 <= minute < 60`, `0 <= second < 60`, and `0 <= millisecond < 1000`, or `240000000 == timeValue`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#