Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
CFDate Class Reference

Date Type of CFPropertyList Note: CFDate uses Unix timestamp (epoch) to store dates internally. More...

Inheritance diagram for CFDate:

Public Member Functions

 __construct ($value, $format=CFDate::TIMESTAMP_UNIX)
 Create new Date CFType.
 
 getValue ($format=CFDate::TIMESTAMP_UNIX)
 Get the Date CFType's value.
 
 setValue ($value, $format=CFDate::TIMESTAMP_UNIX)
 Set the Date CFType's value.
 
 toBinary (CFBinaryPropertyList &$bplist)
 convert value to binary representation
 
 toXML (DOMDocument $doc, $nodeName="")
 Get XML-Node.
 

Static Public Member Functions

static dateValue ($val)
 Create a UNIX timestamp from a PList date string.
 

Public Attributes

const DATE_DIFF_APPLE_UNIX = 978307200
 
const TIMESTAMP_APPLE = 0
 
const TIMESTAMP_UNIX = 1
 

Detailed Description

Date Type of CFPropertyList Note: CFDate uses Unix timestamp (epoch) to store dates internally.

Constructor & Destructor Documentation

◆ __construct()

CFDate::__construct ( $value,
$format = CFDate::TIMESTAMP_UNIX )

Create new Date CFType.

Parameters
integer$valuetimestamp to set
integer$formatformat the timestamp is specified in, use TIMESTAMP_APPLE or TIMESTAMP_UNIX, defaults to TIMESTAMP_APPLE @uses setValue() to convert the timestamp

Member Function Documentation

◆ dateValue()

static CFDate::dateValue ( $val)
static

Create a UNIX timestamp from a PList date string.

Parameters
string$valThe date string (e.g. "2009-05-13T20:23:43Z")
Return values
integerThe UNIX timestamp
Exceptions
PListExceptionwhen encountering an unknown date string format

◆ getValue()

CFDate::getValue ( $format = CFDate::TIMESTAMP_UNIX)

Get the Date CFType's value.

Parameters
integer$formatformat the timestamp is specified in, use TIMESTAMP_APPLE or TIMESTAMP_UNIX, defaults to TIMESTAMP_UNIX
Return values
integerUnix timestamp @uses TIMESTAMP_APPLE to determine timestamp type @uses TIMESTAMP_UNIX to determine timestamp type @uses DATE_DIFF_APPLE_UNIX to convert Unix-timestamp to Apple-timestamp

◆ setValue()

CFDate::setValue ( $value,
$format = CFDate::TIMESTAMP_UNIX )

Set the Date CFType's value.

Parameters
integer$valuetimestamp to set
integer$formatformat the timestamp is specified in, use TIMESTAMP_APPLE or TIMESTAMP_UNIX, defaults to TIMESTAMP_UNIX
Return values
void@uses TIMESTAMP_APPLE to determine timestamp type @uses TIMESTAMP_UNIX to determine timestamp type @uses DATE_DIFF_APPLE_UNIX to convert Apple-timestamp to Unix-timestamp

◆ toBinary()

CFDate::toBinary ( CFBinaryPropertyList & $bplist)

convert value to binary representation

Parameters
CFBinaryPropertyListThe binary property list object
Return values
Theoffset in the object table

◆ toXML()

CFDate::toXML ( DOMDocument $doc,
$nodeName = "" )

Get XML-Node.

Parameters
DOMDocument$docDOMDocument to create DOMNode in
string$nodeNameFor compatibility reasons; just ignore it
Return values
DOMNode<date>-Element

The documentation for this class was generated from the following file: