Overview Package Tree | HessianPHP |
FRAMES NO FRAMES | |
SUMMARY: FIELD METHOD | DETAIL: FIELD METHOD |
default.DateTime
class DateTime
Represents a date time value.
Works with ISO datetime format like "YYYY-MM-DD HH:mm:ss"
Field Summary |
---|
public var | $day |
public var | $month |
public var | $year |
public var | $hour |
public var | $minute |
public var | $second |
private var | $_timestamp |
public var | $weekDay |
Method Summary |
---|
public void | DateTime Constructor |
public void | setTimestamp Uses a timestamp integer to build this object's fields |
public void | sync Rebuilds object's internal timestamp. |
public void | asTime |
public void | asDate |
public string | getTime |
public string | getDate |
public void | getTimestamp |
public void | getWeekDay |
public void | getDayLight |
public void | getLocalWeekDay |
public void | daysInMonth |
public void | isBefore |
public void | isAfter |
public void | equals |
public void | getDateTime |
public void | strftime |
public void | gmstrftime |
public void | daysDiff |
public array | dateDiff Calculates the difference between two DateTime objects. |
public int | compare Compares two date time values (t1 and t2). |
public void | monthName |
public integer | findTimestamp Returns the timestamp contained in $dateObj Can work with DateTime objects, string values and integer timestamps |
private void | __call |
private void | __dateOperation |
public void | add |
public void | sub |
public void | substract |
private void | __toString |
Field Detail |
---|
public var $day
public var $month
public var $year
public var $hour
public var $minute
public var $second
private var $_timestamp
public var $weekDay
Method Detail |
---|
public void DateTime(mixed date = 'now')
Constructor
date
- object, string or timestamp to use as a base for the object public void setTimestamp(integer ts)
Uses a timestamp integer to build this object's fields
ts
- timestamp to decode public void sync()
Rebuilds object's internal timestamp.
A call to this function is needed when adding or substracting days or minutes to the date
public void asTime()
public void asDate()
public string getTime()
public string getDate()
public void getTimestamp()
public void getWeekDay()
public void getDayLight()
public void getLocalWeekDay()
public void daysInMonth()
public void isBefore(var $time)
$time
public void isAfter(var $time)
$time
public void equals(var $time)
$time
public void getDateTime()
public void strftime(var $format)
$format
public void gmstrftime(var $format)
$format
public void daysDiff(var $other)
$other
public array dateDiff(DateTime other)
Calculates the difference between two DateTime objects.
Returns an associative array containing a timespan expressed in days, hours, minutes and seconds.
other
- Object to compare with public int compare(mixed time1, mixed time2)
Compares two date time values (t1 and t2).
Can work with DateTime objects, string values and integer timestamps Possible return values are: -1: t1 < t2 0: t1 = t2 1: t1 > t2
time1
- First time value time2
- Second time value public void monthName(var $value = null)
$value
public integer findTimestamp(mixed dateObj)
Returns the timestamp contained in $dateObj Can work with DateTime objects, string values and integer timestamps
dateObj
- variable to search private void __call(var $method, var $params)
$method
$params
private void __dateOperation(var $op, var $part, var $num)
$op
$part
$num
public void add(var $part, var $num = 1)
$part
$num
public void sub(var $part, var $num = 1)
$part
$num
public void substract(var $part, var $num = 1)
$part
$num
private void __toString()
Overview Package Tree | HessianPHP |
FRAMES NO FRAMES | |
SUMMARY: FIELD METHOD | DETAIL: FIELD METHOD |