Oihana PHP Arango

dateUTCToLocal.php

Table of Contents

Functions

dateUTCToLocal()  : string
Converts a UTC (Zulu time) date or timestamp into a local timezone date.

Functions

dateUTCToLocal()

Converts a UTC (Zulu time) date or timestamp into a local timezone date.

dateUTCToLocal([string|int|null $date = null ][, string $timezone = "Europe/Paris" ][, bool $throwable = false ]) : string

Constructs an AQL expression in the form:

DATE_UTCTOLOCAL(date, timezone, zoneinfo)

Converts a UTC timestamp or ISO 8601 string into the specified local time zone.

If no date is provided, the current time (DATE_NOW()) is used.

By default, throws an InvalidArgumentException if the $timezone is not a valid IANA timezone.

Parameters
$date : string|int|null = null

A numeric timestamp or ISO 8601 date-time string. Defaults to DATE_NOW() if null.

$timezone : string = "Europe/Paris"

IANA timezone name (e.g., "America/New_York", "Europe/Berlin", "UTC"). Use "America/Los_Angeles" for Pacific Time (PST/PDT).

$throwable : bool = false

Whether to throw an exception on invalid timezone (default: true).

Tags
throws
InvalidArgumentException

If the timezone is invalid.

example
echo dateUTCToLocal("2025-10-08T12:00:00Z", "Europe/Paris");
// Produces: DATE_UTCTOLOCAL("2025-10-08T12:00:00Z", "Europe/Paris")

echo dateUTCToLocal(null, "America/New_York");
// Produces: DATE_UTCTOLOCAL(DATE_NOW(), "America/New_York")
see
https://docs.arangodb.com/stable/aql/functions/date/#date_utctolocal
since
1.0.0
author

Marc Alcaraz

Return values
string

The AQL expression returning the date converted from UTC to the specified local time zone.

On this page

Search results