absl::FromDateTime

A convenience wrapper for absl::ConvertDateTime() that simply returns the "pre" absl::Time. That is, the unique result, or the instant that is correct using the pre-transition offset (as if the transition never happened).

Synopsis

Declared in <absl/time/time.h>

[[deprecated("Use `absl::FromCivil(CivilSecond, TimeZone)`.")]]
Time
FromDateTime(
    int64_t year,
    int mon,
    int day,
    int hour,
    int min,
    int sec,
    TimeZone tz);

WARNING

Deprecated: Use `absl::FromCivil(CivilSecond, TimeZone)`.. Use of this entity is allowed but discouraged.

Description

Example:

absl::Time t = absl::FromDateTime(2017, 9, 26, 9, 30, 0, lax); // t = 2017-09-26 09:30:00 -0700

Deprecated. Use absl::FromCivil(CivilSecond, TimeZone). Note that the behavior of FromCivil() differs from FromDateTime() for skipped civil times. If you care about that see absl::TimeZone::At(absl::CivilSecond).

Return Value

The "pre" absolute time for the given civil time in tz.

Parameters

NameDescription
yearThe civil-time year.
monThe civil-time month.
dayThe civil-time day.
hourThe civil-time hour.
minThe civil-time minute.
secThe civil-time second.
tzThe time zone to convert in.