classQDateTime
QDateTime Class Reference
Inherits QBaseClass.

Public Member Functions
- IsDateNull ()
- IsNull ()
- IsTimeNull ()
- PhpDate ($strFormat)
- GetSoapDateTimeArray ($dttArray)
- __construct ($mixValue=null, DateTimeZone $objTimeZone=null)
- __sleep ()
- __wakeup ()
- __toString ($strFormat=null)
- format ($strFormat)
- setTime ($intHour, $intMinute, $intSecond)
- setDate ($intYear, $intMonth, $intDay)
- IsEqualTo (QDateTime $dttCompare)
- IsEarlierThan (QDateTime $dttCompare)
- IsEarlierOrEqualTo (QDateTime $dttCompare)
- IsLaterThan (QDateTime $dttCompare)
- IsLaterOrEqualTo (QDateTime $dttCompare)
- Difference (QDateTime $dttDateTime)
- Add (QDateTimeSpan $dtsSpan)
- AddSeconds ($intSeconds)
- AddMinutes ($intMinutes)
- AddHours ($intHours)
- AddDays ($intDays)
- AddMonths ($intMonths)
- AddYears ($intYears)
- Modify ($mixValue)
- __get ($strName)
- __set ($strName, $mixValue)
- __construct ($mixValue=null)
- IsLaterThan (QDateTime $dttDate)
- IsEarlierThan (QDateTime $dttDate)
- IsEqualTo (QDateTime $dttDate)
- Difference (QDateTime $dttDateTime)
- Add (QDateTimeSpan $dtsSpan)
- Subtract (QDateTimeSpan $dtsSpan)
- __toString ($strFormat=null)
- PHPDate ($strFormat)
- IsNull ()
- IsDateNull ()
- IsTimeNull ()
- GetSoapDateTimeArray ($dttArray)
- setDate ($intYear, $intMonth, $intDay)
- setTime ($intHour, $intMinute, $intSecond)
- __get ($strName)
- __set ($strName, $mixValue)
Static Public Member Functions
- static Now ($blnTimeValue=true)
- static NowToString ($strFormat=null)
- static FromTimestamp ($intTimestamp, DateTimeZone $objTimeZone=null)
- static Now ($blnTimeValue=true)
- static FromTimestamp ($intTimestamp)
- static NowToString ($strFormat=null)
Public Attributes
- const Now = 'now'
- const FormatIso = 'YYYY-MM-DD hhhh:mm:ss'
- const FormatIsoCompressed = 'YYYYMMDDhhhhmmss'
- const FormatDisplayDate = 'MMM DD YYYY'
- const FormatDisplayDateFull = 'DDD, MMMM D, YYYY'
- const FormatDisplayDateTime = 'MMM DD YYYY hh:mm zz'
- const FormatDisplayDateTimeFull = 'DDDD, MMMM D, YYYY, h:mm:ss zz'
- const FormatDisplayTime = 'hh:mm:ss zz'
- const FormatRfc822 = 'DDD, DD MMM YYYY hhhh:mm:ss ttt'
- const FormatSoap = 'YYYY-MM-DDThhhh:mm:ss'
Static Public Attributes
Protected Member Functions
Protected Attributes
- $blnDateNull = true
- $blnTimeNull = true
- $strSerializedData
- $intMonth
- $intDay
- $intYear
- $intHour
- $intMinute
- $intSecond
Detailed Description
QDateTime (Standard) REQUIRES: PHP >= 5.2.0This DateTime class manages datetimes for the entire system. It basically provides a nice wrapper around the PHP DateTime class, which is included with all versions of PHP >= 5.2.0.
For legacy PHP users (PHP < 5.2.0), please refer to QDateTime.legacy
QDateTime.legacy
This DateTime class manages datetimes for the entire system. It basically provides a nice wrapper around the built-in date-related functionality in PHP.
This is used by QCubed users using PHP < 5.2.0 As of Qcodo 0.3.14, no additional functionality will be added to QDateTime.legacy
All new QDateTime functionality will be added to the QDateTime (standard) which uses PHP DateTime, which is included in all versions of >= PHP 5.2.0
Constructor & Destructor Documentation
| QDateTime::__construct | ( | $ | mixValue = null, |
|
| DateTimeZone $ | objTimeZone = null | |||
| ) |
| QDateTime::__construct | ( | $ | mixValue = null |
) |
Constructor function to create a new datetime. Takes in an optional $mixValue, which can be one of the following: ISO Standard format (mostly used in databases) 1977-03-20 15:35:15 ISO-compressed format (the pure digits of the ISO format) 19770320153515 another DateTime object (to clone it) the QDateTime::Now constant (to return current date/time) a unix timestamp null/none (to return a blank date, which by default is set to 0000-01-01 00:00:00) DateTime can be constructed with either the date, the time, or both portions of any of the above formats. For any part that's missing, the date would be set to 0000-01-01, or the time would be set to 00:00:00
- Parameters:
-
$mixValue the date/time to set (see documentation for more information)
- Returns:
- DateTime the new DateTime object
References Now.
Member Function Documentation
| QDateTime::__get | ( | $ | strName | ) |
Override method to perform a property "Get" This will get the value of $strName
- Parameters:
-
string $strName Name of the property to get
- Returns:
- mixed the returned property
Reimplemented from QBaseClass.
References __get(), Difference(), QCallerException::IncrementOffset(), and Now.
| QDateTime::__get | ( | $ | strName | ) |
Override method to perform a property "Get" This will get the value of $strName All inhereted objects that call __get() should always fall through to calling parent::__get() in a try/catch statement catching for CallerExceptions.
- Parameters:
-
string $strName Name of the property to get
- Returns:
- mixed the returned property
Reimplemented from QBaseClass.
References Difference(), format(), Now, and ReinforceNullProperties().
Referenced by __get().
| QDateTime::__set | ( | $ | strName, | |
| $ | mixValue | |||
| ) |
Override method to perform a property "Set" This will set the property $strName to be $mixValue
- Parameters:
-
string $strName Name of the property to set string $mixValue New value of the property
- Returns:
- mixed the property that was set
Reimplemented from QBaseClass.
References QType::Cast(), QCallerException::IncrementOffset(), and QType::Integer.
| QDateTime::__set | ( | $ | strName, | |
| $ | mixValue | |||
| ) |
Override method to perform a property "Set" This will set the property $strName to be $mixValue All inhereted objects that call __set() should always fall through to calling parent::__set() in a try/catch statement catching for CallerExceptions.
- Parameters:
-
string $strName Name of the property to set string $mixValue New value of the property
- Returns:
- mixed the property that was set
Reimplemented from QBaseClass.
References QType::Cast(), QCallerException::IncrementOffset(), QType::Integer, ReinforceNullProperties(), setDate(), and setTime().
| QDateTime::__sleep | ( | ) |
References format().
| QDateTime::__toString | ( | $ | strFormat = null |
) |
Outputs the date as a string given the format strFormat. By default, it will return as QDateTime::FormatDisplayDate "MMM DD YYYY", e.g. Mar 20 1977.
Properties of strFormat are (using Sunday, March 2, 1977 at 1:15:35 pm in the following examples):
M - Month as an integer (e.g., 3) MM - Month as an integer with leading zero (e.g., 03) MMM - Month as three-letters (e.g., Mar) MMMM - Month as full name (e.g., March)
D - Day as an integer (e.g., 2) DD - Day as an integer with leading zero (e.g., 02) DDD - Day of week as three-letters (e.g., Wed) DDDD - Day of week as full name (e.g., Wednesday)
YY - Year as a two-digit integer (e.g., 77) YYYY - Year as a four-digit integer (e.g., 1977)
h - Hour as an integer in 12-hour format (e.g., 1) hh - Hour as an integer in 12-hour format with leading zero (e.g., 01) hhh - Hour as an integer in 24-hour format (e.g., 13) hhhh - Hour as an integer in 24-hour format with leading zero (e.g., 13)
mm - Minute as a two-digit integer
ss - Second as a two-digit integer
z - "pm" or "am" zz - "PM" or "AM" zzz - "p.m." or "a.m." zzzz - "P.M." or "A.M."
ttt - Timezone as a three-letter code (e.g. GMT)
- Parameters:
-
string $strFormat the format of the date
- Returns:
- string the formatted date as a string
References $DefaultFormat.
| QDateTime::__toString | ( | $ | strFormat = null |
) |
Outputs the date as a string given the format strFormat. By default, it will return as QDateTime::FormatDisplayDate "MMM DD YYYY", e.g. Mar 20 1977.
Properties of strFormat are (using Sunday, March 2, 1977 at 1:15:35 pm in the following examples):
M - Month as an integer (e.g., 3) MM - Month as an integer with leading zero (e.g., 03) MMM - Month as three-letters (e.g., Mar) MMMM - Month as full name (e.g., March)
D - Day as an integer (e.g., 2) DD - Day as an integer with leading zero (e.g., 02) DDD - Day of week as three-letters (e.g., Wed) DDDD - Day of week as full name (e.g., Wednesday)
YY - Year as a two-digit integer (e.g., 77) YYYY - Year as a four-digit integer (e.g., 1977)
h - Hour as an integer in 12-hour format (e.g., 1) hh - Hour as an integer in 12-hour format with leading zero (e.g., 01) hhh - Hour as an integer in 24-hour format (e.g., 13) hhhh - Hour as an integer in 24-hour format with leading zero (e.g., 13)
mm - Minute as a two-digit integer
ss - Second as a two-digit integer
z - "pm" or "am" zz - "PM" or "AM" zzz - "p.m." or "a.m." zzzz - "P.M." or "A.M."
ttt - Timezone as a three-letter code (e.g. GMT)
- Parameters:
-
string $strFormat the format of the date
- Returns:
- string the formatted date as a string
References $DefaultFormat, format(), and ReinforceNullProperties().
| QDateTime::__wakeup | ( | ) |
References __construct().
| QDateTime::Add | ( | QDateTimeSpan $ | dtsSpan | ) |
| QDateTime::Add | ( | QDateTimeSpan $ | dtsSpan | ) |
| QDateTime::AddDays | ( | $ | intDays | ) |
| QDateTime::AddHours | ( | $ | intHours | ) |
| QDateTime::AddMinutes | ( | $ | intMinutes | ) |
| QDateTime::AddMonths | ( | $ | intMonths | ) |
| QDateTime::AddSeconds | ( | $ | intSeconds | ) |
| QDateTime::AddYears | ( | $ | intYears | ) |
| QDateTime::Difference | ( | QDateTime $ | dttDateTime | ) |
| QDateTime::Difference | ( | QDateTime $ | dttDateTime | ) |
Referenced by __get(), and QDateTimeSpan::SetFromQDateTime().
| QDateTime::format | ( | $ | strFormat | ) |
References ReinforceNullProperties().
Referenced by __construct(), __get(), __sleep(), __toString(), and PhpDate().
| static QDateTime::FromTimestamp | ( | $ | intTimestamp | ) | [static] |
| static QDateTime::FromTimestamp | ( | $ | intTimestamp, | |
| DateTimeZone $ | objTimeZone = null | |||
| ) | [static] |
- Parameters:
-
integer $intTimestamp DateTimeZone $objTimeZone
- Returns:
- QDateTime
Referenced by QCalendarPopup::__get(), QCalendarPopup::GetControlHtml(), and QCalendarPopup::ParsePostData().
| QDateTime::GetSoapDateTimeArray | ( | $ | dttArray | ) |
This returns an array of strings with ISO-formatted datetime values, given an array of QDateTime objects
- Returns:
- string[] array of ISO-formatted datetime strings
References FormatSoap.
| QDateTime::GetSoapDateTimeArray | ( | $ | dttArray | ) |
References FormatSoap.
| QDateTime::IsDateNull | ( | ) |
This returns a boolean specifying whether or not the Date portion is null
- Returns:
- boolean whether or not the date is null
| QDateTime::IsDateNull | ( | ) |
| QDateTime::IsEarlierOrEqualTo | ( | QDateTime $ | dttCompare | ) |
| QDateTime::IsEarlierThan | ( | QDateTime $ | dttDate | ) |
| QDateTime::IsEarlierThan | ( | QDateTime $ | dttCompare | ) |
| QDateTime::IsEqualTo | ( | QDateTime $ | dttDate | ) |
| QDateTime::IsEqualTo | ( | QDateTime $ | dttCompare | ) |
| QDateTime::IsLaterOrEqualTo | ( | QDateTime $ | dttCompare | ) |
| QDateTime::IsLaterThan | ( | QDateTime $ | dttDate | ) |
| QDateTime::IsLaterThan | ( | QDateTime $ | dttCompare | ) |
| QDateTime::IsNull | ( | ) |
This returns a boolean specifying whether or not this object DateTime is null
- Returns:
- boolean whether or not the datetime object is null
| QDateTime::IsNull | ( | ) |
| QDateTime::IsTimeNull | ( | ) |
This returns a boolean specifying whether or not the Date portion is null
- Returns:
- boolean whether or not the time is null
| QDateTime::IsTimeNull | ( | ) |
| QDateTime::Modify | ( | $ | mixValue | ) |
| static QDateTime::Now | ( | $ | blnTimeValue = true |
) | [static] |
| static QDateTime::Now | ( | $ | blnTimeValue = true |
) | [static] |
| static QDateTime::NowToString | ( | $ | strFormat = null |
) | [static] |
Shortcut to output the current datetime in any defined format. Follows the same formatting mechanism as __toString. This is basically a shortcut to doing: $dttNow = new QDateTime(QDateTime::Now); $dttNow->__toString($strFormat);
- Parameters:
-
string $strFormat the format of the datetime
- Returns:
- string the formatted current datetime as a string
References $DefaultFormat, and Now.
| static QDateTime::NowToString | ( | $ | strFormat = null |
) | [static] |
| QDateTime::PHPDate | ( | $ | strFormat | ) |
This makes a call to the PHP date() function, where you can pass in a PHP date()-compatible format to display this date/time object.
- Parameters:
-
string $strFormat a PHP date()-compatible string format for datetime
- Returns:
- string the output from the PHP date() call
| QDateTime::PhpDate | ( | $ | strFormat | ) |
References format().
| QDateTime::ReinforceNullProperties | ( | ) | [protected] |
| QDateTime::setDate | ( | $ | intYear, | |
| $ | intMonth, | |||
| $ | intDay | |||
| ) |
- Parameters:
-
integer $intYear integer $intMonth integer $intDay
References $intDay, $intMonth, $intYear, QType::Cast(), QCallerException::IncrementOffset(), and QType::Integer.
| QDateTime::setDate | ( | $ | intYear, | |
| $ | intMonth, | |||
| $ | intDay | |||
| ) |
References $intDay, $intMonth, $intYear, QType::Cast(), and QType::Integer.
Referenced by __set(), and ReinforceNullProperties().
| QDateTime::setTime | ( | $ | intHour, | |
| $ | intMinute, | |||
| $ | intSecond | |||
| ) |
- Parameters:
-
integer $intHour integer $intMinute integer $intSecond
References $intHour, $intMinute, $intSecond, QType::Cast(), QCallerException::IncrementOffset(), and QType::Integer.
| QDateTime::setTime | ( | $ | intHour, | |
| $ | intMinute, | |||
| $ | intSecond | |||
| ) |
References $intHour, $intMinute, $intSecond, QType::Cast(), and QType::Integer.
Referenced by __set(), and ReinforceNullProperties().
| QDateTime::Subtract | ( | QDateTimeSpan $ | dtsSpan | ) |
Member Data Documentation
QDateTime::$blnDateNull = true [protected] |
QDateTime::$blnTimeNull = true [protected] |
QDateTime::$DefaultFormat = QDateTime::FormatDisplayDate [static] |
Referenced by __toString(), and NowToString().
QDateTime::$intDay [protected] |
Referenced by setDate().
QDateTime::$intHour [protected] |
Referenced by setTime().
QDateTime::$intMinute [protected] |
Referenced by setTime().
QDateTime::$intMonth [protected] |
Referenced by setDate().
QDateTime::$intSecond [protected] |
Referenced by setTime().
QDateTime::$intYear [protected] |
Referenced by setDate().
QDateTime::$strSerializedData [protected] |
| const QDateTime::FormatDisplayDate = 'MMM DD YYYY' |
Constant for __toString to display Date as simple Mar 20 1977
Referenced by QCalendarPopup::GetControlHtml().
| const QDateTime::FormatDisplayDateFull = 'DDD, MMMM D, YYYY' |
Constant for __toString to display Date as extended Sunday, March 20, 1977
| const QDateTime::FormatDisplayDateTime = 'MMM DD YYYY hh:mm zz' |
Constant for __toString to display Date/Time as simple Mar 20 1977 03:35 PM
| const QDateTime::FormatDisplayDateTimeFull = 'DDDD, MMMM D, YYYY, h:mm:ss zz' |
Constant for __toString to display Date/Time as extended Sunday, March 20, 1977, 3:35:15 PM
| const QDateTime::FormatDisplayTime = 'hh:mm:ss zz' |
Constant for __toString to display Time as 03:35:15 PM
| const QDateTime::FormatIso = 'YYYY-MM-DD hhhh:mm:ss' |
Constant for __toString to display Date/Time as ISO Standard 1977-03-20 15:35:15
Referenced by QDatabaseBase::SqlVariable(), QSqlServerDatabase::SqlVariable(), and QPostgreSqlDatabase::SqlVariable().
| const QDateTime::FormatIsoCompressed = 'YYYYMMDDhhhhmmss' |
Constant for __toString to display Date/Time as 14-digit 19770320153515
| const QDateTime::FormatRfc822 = 'DDD, DD MMM YYYY hhhh:mm:ss ttt' |
Constant for __toString to display DateTime as RFC 822 Format Sun, 20 Mar 1977 15:35:15 GMT
Referenced by QRssItem::GetXml(), QRssFeed::GetXml(), and QEmailServer::Send().
| const QDateTime::FormatSoap = 'YYYY-MM-DDThhhh:mm:ss' |
Constant for __toString to display Date/Time as SOAP Standard 1977-03-20T15:35:15
Referenced by GetSoapDateTimeArray().
| const QDateTime::Now = 'now' |
Pass this to __construct in order to set DateTime to current date/time. e.g. $dttDate = new QDateTime(QDateTime::Now);
Referenced by __construct(), __get(), QDateTimeTextBox::__set(), Now(), NowToString(), and QDateTimeTextBox::Validate().
The documentation for this class was generated from the following files:
- qcodo/_core/framework/QDateTime.class.php
- qcodo/_core/framework/QDateTime.legacy.class.php
