[#absl-FormatTime-05]
= xref:absl.adoc[absl]::FormatTime
:relfileprefix: ../
:mrdocs:

Formats the given `absl&colon;&colon;Time` in the `absl&colon;&colon;TimeZone` according to the provided format string&period; Uses strftime()&hyphen;like formatting options, with the following extensions&colon;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::string
FormatTime(
    std::string&lowbar;view format,
    xref:absl/Time.adoc[Time] t,
    xref:absl/TimeZone.adoc[TimeZone] tz);
----

== Description

* %Ez &hyphen; RFC3339&hyphen;compatible numeric UTC offset (&plus;hh&colon;mm or &hyphen;hh&colon;mm)
* %E&ast;z &hyphen; Full&hyphen;resolution numeric UTC offset (&plus;hh&colon;mm&colon;ss or &hyphen;hh&colon;mm&colon;ss)
* %E&num;S &hyphen; Seconds with &num; digits of fractional precision
* %E_S &hyphen; Seconds with full fractional precision (a literal &apos;_&apos;)
* %E&num;f &hyphen; Fractional seconds with &num; digits of precision
* %E_f &hyphen; Fractional seconds with full precision (a literal &apos;_&apos;)
* %E4Y &hyphen; Four&hyphen;character years (&hyphen;999 &period;&period;&period; &hyphen;001, 0000, 0001 &period;&period;&period; 9999)
* %ET &hyphen; The RFC3339 &quot;date&hyphen;time&quot; separator &quot;T&quot;

Note that %E0S behaves like %S, and %E0f produces no characters&period; In contrast %E&ast;f always produces at least one digit, which may be &apos;0&apos;&period;

Note that %Y produces as many characters as it takes to fully render the year&period; A year outside of &lsqb;&hyphen;999&colon;9999&rsqb;when formatted with %E4Y will produce more than four characters, just like %Y&period;

We recommend that format strings include the UTC offset (%z, %Ez, or %E&ast;z) so that the result uniquely identifies a time instant&period;

Example&colon;

absl&colon;&colon;CivilSecond cs(2013, 1, 2, 3, 4, 5)&semi; absl&colon;&colon;Time t &equals; absl&colon;&colon;FromCivil(cs, lax)&semi; std&colon;&colon;string f &equals; absl&colon;&colon;FormatTime(&quot;%H&colon;%M&colon;%S&quot;, t, lax)&semi; &sol;&sol; &quot;03&colon;04&colon;05&quot; f &equals; absl&colon;&colon;FormatTime(&quot;%H&colon;%M&colon;%E3S&quot;, t, lax)&semi; &sol;&sol; &quot;03&colon;04&colon;05&period;000&quot;

Note&colon; If the given `absl&colon;&colon;Time` is `absl&colon;&colon;InfiniteFuture()`, the returned string will be exactly &quot;infinite&hyphen;future&quot;&period; If the given `absl&colon;&colon;Time` is `absl&colon;&colon;InfinitePast()`, the returned string will be exactly &quot;infinite&hyphen;past&quot;&period; In both cases the given format string and `absl&colon;&colon;TimeZone` are ignored&period;

== Return Value

The formatted time string&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *format*
| The strftime()&hyphen;like format string&period;
| *t*
| The time to format&period;
| *tz*
| The time zone to format in&period;
|===


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