Oihana PHP Arango

dateLocalToUTC.php

Table of Contents

Functions

dateLocalToUTC()  : string
Converts a local date/time from a specified timezone to UTC.

Functions

dateLocalToUTC()

Converts a local date/time from a specified timezone to UTC.

dateLocalToUTC([int|string|null $date = null ][, string $timezone = "UTC" ][, bool $throwable = true ]) : string

Constructs an AQL expression in the format:

DATE_LOCALTOUTC(date, timezone)

where date can be a numeric timestamp or ISO 8601 string, and timezone is a valid IANA timezone name.

If $date is null, the current date/time (DATE_NOW()) is used.

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

Parameters
$date : int|string|null = null

Numeric timestamp or ISO 8601 date string. Defaults to DATE_NOW() if null.

$timezone : string = "UTC"

IANA timezone name (e.g., "Europe/Paris", "America/New_York").

$throwable : bool = true

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

Tags
example
echo dateLocalToUTC('2025-10-08T12:34:56', 'Europe/Paris');
// Produces: DATE_LOCALTOUTC("2025-10-08T12:34:56", "Europe/Paris")
see
https://docs.arangodb.com/stable/aql/functions/date/#date_localtoutc
since
1.0.0
author

Marc Alcaraz

Return values
string

The AQL expression returning the date converted to UTC.

On this page

Search results