Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZDateTime Class Reference

## Public Member Functions
| __construct ( $year=-1, $month=-1, $day=-1, $hour=-1, $minute=-1, $second=-1)
| year ()
| month ()
| day ()
| hour ()
| minute ()
| second ()
| mySQLDateTime ()
| setYear ( $value)
| setMonth ( $value)
| setDay ( $value)
| setHour ( $value)
| setMinute ( $value)
| setSecond ( $value)
| setSecondsElapsed ( $value)
| setSecondsElapsedHMS ( $hour, $minute, $second)
& | date ()
& | time ()
| setMySQLDateTime ( $value)
| setMySQLTimeStamp ( $value)
| setTimeStamp ( $value)
| mysqlTimeStamp ()
| daysInMonth ()
| dayOfWeek ( $mondayFirst)
| dayName ( $mondayFirst)
| monthName ()
| isValid ()
| dateEquals ( $date)
| isGreater (&$datetime, $equal=false)

## Static Public Member Functions
| timeStamp ( $returnNow=false)
static | addZero ( $value)

## Public Attributes
| $Date
| $Time

## Detailed Description

! eZCommon The eZDateTime class provides date and functions.

Example:

//Create a new eZDateTime object, and set the date and time from a MySQL date time.
$datetime = new eZDateTime();
$datetime->setMySQLDateTime( "2000-10-07 16:45:32" );
// print the date and time in localized format
print( "Date and time:" . $locale->format( $datetime ) . "<br>" );
// print the day and month names in localized format
print( "Day:" . $locale->dayName( $datetime->dayName( $locale->mondayFirst() ) ) . "<br>" );
print( "Month:" . $locale->monthName( $datetime->monthName() ) . "<br>" );
$locale
$locale
Definition: admin/adlist.php:127
$datetime
$datetime
Definition: appointmentview.php:108
eZDateTime
Definition: ezdatetime.php:55

See also
  eZDate eZTime eZLocale

TODO

Definition at line 54 of file ezdatetime.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZDateTime::__construct | ( |  | $year = `-1`,
|  |  | $month = `-1`,
|  |  | $day = `-1`,
|  |  | $hour = `-1`,
|  |  | $minute = `-1`,
|  |  | $second = `-1`
| ) |  |

Constructs a new eZDateTime object. If the parameters are set the date and time is set accordingly. If not the current local time and date are used.

Definition at line 60 of file ezdatetime.php.

References $day, $hour, $minute, $month, $now, and $year.

## Member Function Documentation

## ◆ addZero()

static eZDateTime::addZero | ( |  | $value | ) |
| static

Adds a "0" infront of the value if it's below 10.

Definition at line 363 of file ezdatetime.php.

References $ret.

Referenced by eZPBLog\__construct(), filterRecurring(), eZGroupEvent\getAllByDate(), eZGroupEvent\getAllByType(), eZGroupEvent\getByDate(), eZGroupEvent\getByGroupType(), and mysqlTimeStamp().

## ◆ date()

& eZDateTime::date | ( |  | ) |

Returns the date component of the date time object as an eZDate object.

Definition at line 244 of file ezdatetime.php.

References $Date.

Referenced by setTimeStamp().

## ◆ dateEquals()

eZDateTime::dateEquals | ( |  | $date | ) |

Returns true if the current date equals the supplied date.

Definition at line 420 of file ezdatetime.php.

References $date.

## ◆ day()

eZDateTime::day | ( |  | ) |

Returns the day of the month.

Definition at line 94 of file ezdatetime.php.

Referenced by mySQLDateTime(), mysqlTimeStamp(), and timeStamp().

## ◆ dayName()

eZDateTime::dayName | ( |  | $mondayFirst | ) |

Returns the name of the weekday in three letters. If mondayFirst is true, the week starts on Monday, else on Sunday.

Definition at line 395 of file ezdatetime.php.

## ◆ dayOfWeek()

eZDateTime::dayOfWeek | ( |  | $mondayFirst | ) |

Returns the day of week. ( 1..7 ) If mondayFirst is true, the week starts on Monday, else on Sunday.

Definition at line 386 of file ezdatetime.php.

## ◆ daysInMonth()

eZDateTime::daysInMonth | ( |  | ) |

Returns the number of days in the current month.

Definition at line 377 of file ezdatetime.php.

## ◆ hour()

eZDateTime::hour | ( |  | ) |

Returns the hours.

Definition at line 102 of file ezdatetime.php.

Referenced by mySQLDateTime(), mysqlTimeStamp(), and timeStamp().

## ◆ isGreater()

eZDateTime::isGreater | ( | & | $datetime,
|  |  | $equal = `false`
| ) |  |

Returns true if the eZDateTime object given as argument is greater than the internal values.

If $equal is set to true then true is returned if the datetime is greater than or equal.

Returns false is the object is not a eZDateTime object.

Definition at line 434 of file ezdatetime.php.

References $datetime, and $ret.

## ◆ isValid()

eZDateTime::isValid | ( |  | ) |

Returns true if the current date is valid.

Definition at line 412 of file ezdatetime.php.

## ◆ minute()

eZDateTime::minute | ( |  | ) |

Returns the minutes.

Definition at line 110 of file ezdatetime.php.

Referenced by mySQLDateTime(), mysqlTimeStamp(), and timeStamp().

## ◆ month()

eZDateTime::month | ( |  | ) |

The month value is returned.

Definition at line 86 of file ezdatetime.php.

Referenced by mySQLDateTime(), mysqlTimeStamp(), and timeStamp().

## ◆ monthName()

eZDateTime::monthName | ( |  | ) |

Returns the name of the month in three letters.

Definition at line 404 of file ezdatetime.php.

## ◆ mySQLDateTime()

eZDateTime::mySQLDateTime | ( |  | ) |

Get the current datetime in MySQL format.

Definition at line 126 of file ezdatetime.php.

References $current, $day, $hour, $minute, $month, day(), hour(), minute(), month(), second(), and year().

## ◆ mysqlTimeStamp()

eZDateTime::mysqlTimeStamp | ( |  | ) |

Returns the MySQL timestamp equivalent to the date and time stored in the object.

Definition at line 345 of file ezdatetime.php.

References $day, $hour, $minute, $month, $year, addZero(), day(), hour(), minute(), month(), second(), and year().

## ◆ second()

eZDateTime::second | ( |  | ) |

Returns the seconds.

Definition at line 118 of file ezdatetime.php.

Referenced by mySQLDateTime(), mysqlTimeStamp(), and timeStamp().

## ◆ setDay()

eZDateTime::setDay | ( |  | $value | ) |

Sets the day value.

Definition at line 195 of file ezdatetime.php.

Referenced by setMySQLDateTime(), setMySQLTimeStamp(), and setTimeStamp().

## ◆ setHour()

eZDateTime::setHour | ( |  | $value | ) |

Sets the Hour value.

Definition at line 203 of file ezdatetime.php.

Referenced by setMySQLDateTime(), setMySQLTimeStamp(), and setTimeStamp().

## ◆ setMinute()

eZDateTime::setMinute | ( |  | $value | ) |

Sets the minute value.

Definition at line 211 of file ezdatetime.php.

Referenced by setMySQLDateTime(), setMySQLTimeStamp(), and setTimeStamp().

## ◆ setMonth()

eZDateTime::setMonth | ( |  | $value | ) |

Sets the month value.

Definition at line 187 of file ezdatetime.php.

Referenced by setMySQLDateTime(), setMySQLTimeStamp(), and setTimeStamp().

## ◆ setMySQLDateTime()

eZDateTime::setMySQLDateTime | ( |  | $value | ) |

Sets the data according to the MySQL date given as paramenter. If the paramenter is invalid nothing is set and an error is printed.

Definition at line 262 of file ezdatetime.php.

References setDay(), setHour(), setMinute(), setMonth(), setSecond(), and setYear().

## ◆ setMySQLTimeStamp()

eZDateTime::setMySQLTimeStamp | ( |  | $value | ) |

Sets the data according to the MySQL timestamp given as parameter.

Definition at line 282 of file ezdatetime.php.

References setDay(), setHour(), setMinute(), setMonth(), setSecond(), and setYear().

## ◆ setSecond()

eZDateTime::setSecond | ( |  | $value | ) |

Sets the second value.

Definition at line 219 of file ezdatetime.php.

Referenced by setMySQLDateTime(), setMySQLTimeStamp(), and setTimeStamp().

## ◆ setSecondsElapsed()

eZDateTime::setSecondsElapsed | ( |  | $value | ) |

Sets the number of seconds elapsed since midnight.

Definition at line 227 of file ezdatetime.php.

## ◆ setSecondsElapsedHMS()

eZDateTime::setSecondsElapsedHMS | ( |  | $hour,
|  |  | $minute,
|  |  | $second
| ) |  |

Sets the number of seconds elapsed since midnight, user HH MM SS

Definition at line 235 of file ezdatetime.php.

References $hour, and $minute.

## ◆ setTimeStamp()

eZDateTime::setTimeStamp | ( |  | $value | ) |

Sets the data according to the UNIX timestamp given as argument.

Definition at line 302 of file ezdatetime.php.

References date(), setDay(), setHour(), setMinute(), setMonth(), setSecond(), and setYear().

## ◆ setYear()

eZDateTime::setYear | ( |  | $value | ) |

Sets the year value.

Definition at line 179 of file ezdatetime.php.

Referenced by setMySQLDateTime(), setMySQLTimeStamp(), and setTimeStamp().

## ◆ time()

& eZDateTime::time | ( |  | ) |

Returns the time component of the date time object as an eZTime object.

Definition at line 253 of file ezdatetime.php.

References $Time.

Referenced by timeStamp().

## ◆ timeStamp()

eZDateTime::timeStamp | ( |  | $returnNow = `false` | ) |
| static

Returns the timestamp as a UNIX timestamp.

If returnNow is set to true a timestamp of the current time is returned.

Definition at line 328 of file ezdatetime.php.

References day(), hour(), minute(), month(), second(), time(), and year().

Referenced by eZProduct\addFile().

## ◆ year()

eZDateTime::year | ( |  | ) |

The year is returned in Y2K compatible format.

Definition at line 78 of file ezdatetime.php.

Referenced by mySQLDateTime(), mysqlTimeStamp(), and timeStamp().

## Member Data Documentation

## ◆ $Date

eZDateTime::$Date

Definition at line 449 of file ezdatetime.php.

Referenced by date().

## ◆ $Time

eZDateTime::$Time

Definition at line 450 of file ezdatetime.php.

Referenced by time().

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

- ezdatetime.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.