Datetime

Handling datetime information

Returns object, which is extended from eDate -class. Adds methods for setting, manipulating and getting time information.

Arguments

$datestring
Date in various string formats:
Y-m-d h:i:s
d.m.Y h:i:s
timestamp
eDatetime

Example

Get datetime object from variable:

$Datetime = $this->get('datetime', $order_time);

Full method list

Extends eDate. Class is chainable. ie. all methods that returns 'this' can be written in chain. When cast to string, class returns the date in local or setFormat() -format.

Time value

Method Return type Description
getHm() 00:00 Get hours and minutes

Comparing times

Compare to other date Return type Description
countSecondsTo(datetime) int Get number of seconds to given datetime.
countSecondsFrom(datetime) int Get number of seconds from given date.
countMinutesTo(datetime[,decimals,round]) int Get number of minutes to given datetime.
countMinutesFrom(datetime[,decimals,round]) int Get number of minutes from given date.
countHoursTo(datetime[,decimals,round]) int Get number of hours to given datetime.
countHoursFrom(datetime[,decimals,round]) int Get number of hours from given date.
decimals
Number of decimals the value is rounded to
round
Round method as in eNumber::roundValue()
- ROUND, NORMAL
- CEIL, UP, ROUND_UP
- FLOOR, DOWN, ROUND_DOWN
- EVEN, HALF_EVEN
- ODD, HALF_ODD