\Google\AdsApi\AdManager\Util\v202111AdManagerDateTimes

Static utility methods for working with Ad Manager `DateTime` objects.

Summary

Methods
Properties
Constants
fromDateTime()
fromDateTimeString()
toDateTime()
toDateTimeString()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
__construct()
No private properties found
N/A

Methods

fromDateTime()

fromDateTime(\DateTime  $dateTime): \Google\AdsApi\AdManager\v202111\DateTime

Creates a Ad Manager date time from a PHP date time.

Parameters

\DateTime $dateTime

Returns

\Google\AdsApi\AdManager\v202111\DateTime

fromDateTimeString()

fromDateTimeString(string  $dateTime): \Google\AdsApi\AdManager\v202111\DateTime

Creates a Ad Manager date time from a date time string in ISO 8601 format.

Parameters

string $dateTime

Returns

\Google\AdsApi\AdManager\v202111\DateTime

toDateTime()

toDateTime(\Google\AdsApi\AdManager\v202111\DateTime  $adManagerDateTime): \DateTime

Converts a Ad Manager date time to a PHP date time.

Parameters

\Google\AdsApi\AdManager\v202111\DateTime $adManagerDateTime

Returns

\DateTime

toDateTimeString()

toDateTimeString(\Google\AdsApi\AdManager\v202111\DateTime  $adManagerDateTime,null|string  $timeZoneId = null): string

Returns an ISO 8601 string representation of the specified Ad Manager date time.

Optionally, you may specify the timezone you want to view the date time in. By default the time zone from the Ad Manager date time is used. For example, if the Ad Manager date time holds 11/29/2016 21:05:30 in GMT, the result from this method with Europe/Paris as the new time zone, would be 11/29/2016 22:05:30 in CET. This is useful for displaying Ad Manager date times in your network's time zone. For example:

$timeZoneId = $networkService->getCurrentNetwork()->getTimeZone();
$dateTimeString = AdManagerDateTimes::toDateTimeString(
    $adManagerDateTime,
    $timeZoneId
);

Parameters

\Google\AdsApi\AdManager\v202111\DateTime $adManagerDateTime
null|string $timeZoneId

optional

Returns

string

__construct()

__construct()