Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 55 lines (2 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Date:: (2 methods):
  iso8601Encode()
  iso8601Decode()


Class: Date  - X-Ref

iso8601Encode($timet, $utc = 0)   X-Ref
Given a timestamp, return the corresponding ISO8601 encoded string.

Really, timezones ought to be supported but the XML-RPC spec says:

"Don't assume a timezone. It should be specified by the server in its documentation what assumptions it makes
about timezones."

These routines always assume localtime unless $utc is set to 1, in which case UTC is assumed and an adjustment
for locale is made when encoding

param: int $timet (timestamp)
param: int $utc (0 or 1)
return: string

iso8601Decode($idate, $utc = 0)   X-Ref
Given an ISO8601 date string, return a timet in the localtime, or UTC.

param: string $idate
param: int $utc either 0 or 1
return: int (datetime)