[#absl-ParseTime-06]
= xref:absl.adoc[absl]::ParseTime
:relfileprefix: ../
:mrdocs:

Parses an input string according to the provided format string and returns the corresponding `absl&colon;&colon;Time`&period; Uses strftime()&hyphen;like formatting options, with the same extensions as FormatTime(), but with the exceptions that %E&num;S is interpreted as %E_S, and %E&num;f as %E_f&period; %Ez and %E&ast;z also accept the same inputs, which (along with %z) includes &apos;z&apos; and &apos;Z&apos; as synonyms for &plus;00&colon;00&period; %ET accepts either &apos;T&apos; or &apos;t&apos;&period;

== Synopsis

Declared in `&lt;absl&sol;time&sol;time&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
ParseTime(
    std::string&lowbar;view format,
    std::string&lowbar;view input,
    xref:absl/Time.adoc[Time]* time,
    std::string* err);
----

== Description

%Y consumes as many numeric characters as it can, so the matching data should always be terminated with a non&hyphen;numeric&period; %E4Y always consumes exactly four characters, including any sign&period;

Unspecified fields are taken from the default date and time of &period;&period;&period;

&quot;1970&hyphen;01&hyphen;01 00&colon;00&colon;00&period;0 &plus;0000&quot;

For example, parsing a string of &quot;15&colon;45&quot; (%H&colon;%M) will return an absl&colon;&colon;Time that represents &quot;1970&hyphen;01&hyphen;01 15&colon;45&colon;00&period;0 &plus;0000&quot;&period;

Note that since ParseTime() returns time instants, it makes the most sense to parse fully&hyphen;specified date&sol;time strings that include a UTC offset (%z, %Ez, or %E&ast;z)&period;

Note also that `absl&colon;&colon;ParseTime()` only heeds the fields year, month, day, hour, minute, (fractional) second, and UTC offset&period; Other fields, like weekday (%a or %A), while parsed for syntactic validity, are ignored in the conversion&period;

Date and time fields that are out&hyphen;of&hyphen;range will be treated as errors rather than normalizing them like `absl&colon;&colon;CivilSecond` does&period; For example, it is an error to parse the date &quot;Oct 32, 2013&quot; because 32 is out of range&period;

A leap second of &quot;&colon;60&quot; is normalized to &quot;&colon;00&quot; of the following minute with fractional seconds discarded&period; The following table shows how the given seconds and subseconds will be parsed&colon;

&quot;59&period;x&quot; &hyphen;&gt; 59&period;x &sol;&sol; exact &quot;60&period;x&quot; &hyphen;&gt; 00&period;0 &sol;&sol; normalized &quot;00&period;x&quot; &hyphen;&gt; 00&period;x &sol;&sol; exact

Errors are indicated by returning false and assigning an error message to the &quot;err&quot; out param if it is non&hyphen;null&period;

Note&colon; If the input string is exactly &quot;infinite&hyphen;future&quot;, the returned `absl&colon;&colon;Time` will be `absl&colon;&colon;InfiniteFuture()` and `true` will be returned&period; If the input string is &quot;infinite&hyphen;past&quot;, the returned `absl&colon;&colon;Time` will be `absl&colon;&colon;InfinitePast()` and `true` will be returned&period;

== Return Value

`true` upon successful parsing&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *format*
| The strftime()&hyphen;like format string&period;
| *input*
| The string to parse&period;
| *time*
| Output parameter receiving the parsed time&period;
| *err*
| Output parameter receiving an error message on failure&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
