[#absl-ParseCivilTime-022]
= xref:absl.adoc[absl]::ParseCivilTime
:relfileprefix: ../
:mrdocs:

Parses a civil&hyphen;time value from the specified `absl&colon;&colon;string&lowbar;view` into the passed output parameter&period; Returns `true` upon successful parsing&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
ParseCivilTime(
    std::string&lowbar;view s,
    xref:absl/CivilSecond.adoc[CivilSecond]* c);
----

== Description

The expected form of the input string is as follows&colon;

Type &verbar; Format &hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen; CivilSecond &verbar; YYYY&hyphen;MM&hyphen;DDTHH&colon;MM&colon;SS CivilMinute &verbar; YYYY&hyphen;MM&hyphen;DDTHH&colon;MM CivilHour &verbar; YYYY&hyphen;MM&hyphen;DDTHH CivilDay &verbar; YYYY&hyphen;MM&hyphen;DD CivilMonth &verbar; YYYY&hyphen;MM CivilYear &verbar; YYYY

Example&colon;

absl&colon;&colon;CivilDay d&semi; bool ok &equals; absl&colon;&colon;ParseCivilTime(&quot;2018&hyphen;01&hyphen;02&quot;, &amp;d)&semi; &sol;&sol; OK

Parsing tolerates the following variations from the standard format&colon; &ast; Leading and trailing whitespace is ignored&period; &ast; The year component may be negative (prefixed with &apos;&hyphen;&apos;) and may contain an arbitrary number of digits&period; &ast; Sub&hyphen;year components (month, day, hour, minute, second) may consist of either one or two digits&period;

Note that parsing will fail if the string&apos;s format does not match the expected type exactly&period; `ParseLenientCivilTime()` below is more lenient&period;

== Return Value

`true` upon successful parsing&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *s*
| The string to parse&period;
| *c*
| Output parameter receiving the parsed civil&hyphen;time value&period;
|===


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