Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

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

## Public Member Functions
| __construct ( $year=0, $month=0, $day=0, $year_add=0, $month_add=0, $day_add=0)
| year ()
| month ()
| day ()
| setYear ( $value)
| setMonth ( $value)
| setDay ( $value)
| setMySQLDate ( $value)
| mySQLDate ()
| setTimeStamp ( $value)
| daysInMonth ()
| dayOfWeek ( $mondayFirst=true)
| dayName ( $mondayFirst)
| monthName ()
| isValid ()
| equals ( $date)
| isGreater (&$date, $equal=false)
| move ( $year_num, $month_num, $day_num)

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

## Public Attributes
| $Year
| $Month
| $Day

## Private Member Functions
| addZero ( $value)

## Detailed Description

! eZCommon The eZDate class provides date functions.

Example:

// Create new eZDate objects.
$date = new eZDate( 2000, 9, 2 );
$date2 = new eZDate( );
$date2->setMySQLDate( "2000-12-02" );
// print out the current date
print( $date->year() . " " . $date->month() . " " . $date->day() );
$date
$date
Definition: bugpreview.php:66
eZDate
Definition: ezdate.php:46

See also
  eZDateTime eZTime eZLocale

Definition at line 45 of file ezdate.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZDate::__construct | ( |  | $year = `0`,
|  |  | $month = `0`,
|  |  | $day = `0`,
|  |  | $year_add = `0`,
|  |  | $month_add = `0`,
|  |  | $day_add = `0`
| ) |  |

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

Definition at line 51 of file ezdate.php.

References $day, $month, $now, $year, move(), setDay(), setMonth(), and setYear().

## Member Function Documentation

## ◆ addZero()

eZDate::addZero | ( |  | $value | ) |
| private

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

Definition at line 227 of file ezdate.php.

References $ret.

Referenced by eZMySQLDB\dateToNative(), eZSQLite3DB\dateToNative(), and mySQLDate().

## ◆ day()

eZDate::day | ( |  | ) |

Returns the day of the month.

Definition at line 94 of file ezdate.php.

References $Day.

Referenced by timeStamp().

## ◆ dayName()

eZDate::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 242 of file ezdate.php.

References $day, and dayOfWeek().

## ◆ dayOfWeek()

eZDate::dayOfWeek | ( |  | $mondayFirst = `true` | ) |

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

Definition at line 206 of file ezdate.php.

Referenced by dayName().

## ◆ daysInMonth()

eZDate::daysInMonth | ( |  | ) |

Returns the number of days in the current month.

Definition at line 195 of file ezdate.php.

## ◆ equals()

eZDate::equals | ( |  | $date | ) |

Returns true if the current date equals the supplied date.

Definition at line 439 of file ezdate.php.

References $date.

## ◆ isGreater()

eZDate::isGreater | ( | & | $date,
|  |  | $equal = `false`
| ) |  |

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

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

Returns false is the object is not a eZDate object.

Definition at line 462 of file ezdate.php.

References $date, and $ret.

## ◆ isValid()

eZDate::isValid | ( |  | ) |

Returns true if the current date is valid.

Definition at line 431 of file ezdate.php.

## ◆ month()

eZDate::month | ( |  | ) |

The month value is returned.

Definition at line 86 of file ezdate.php.

References $Month.

Referenced by timeStamp().

## ◆ monthName()

eZDate::monthName | ( |  | ) |

Returns the name of the month in three letters.

Definition at line 347 of file ezdate.php.

References $month.

## ◆ move()

eZDate::move | ( |  | $year_num,
|  |  | $month_num,
|  |  | $day_num
| ) |  |

Moves the current date n days, m months and o years forward, or backward if negative.

Definition at line 503 of file ezdate.php.

References $date.

Referenced by __construct().

## ◆ mySQLDate()

eZDate::mySQLDate | ( |  | ) |

Returns the date formatted for mySQL...

Definition at line 147 of file ezdate.php.

References $Year, and addZero().

## ◆ setDay()

eZDate::setDay | ( |  | $value | ) |

Sets the day value;

Definition at line 120 of file ezdate.php.

Referenced by __construct(), setMySQLDate(), and setTimeStamp().

## ◆ setMonth()

eZDate::setMonth | ( |  | $value | ) |

Sets the month value.

Definition at line 111 of file ezdate.php.

Referenced by __construct(), setMySQLDate(), and setTimeStamp().

## ◆ setMySQLDate()

eZDate::setMySQLDate | ( |  | $value | ) |

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

Definition at line 130 of file ezdate.php.

References setDay(), setMonth(), and setYear().

## ◆ setTimeStamp()

eZDate::setTimeStamp | ( |  | $value | ) |

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

Definition at line 159 of file ezdate.php.

References setDay(), setMonth(), and setYear().

## ◆ setYear()

eZDate::setYear | ( |  | $value | ) |

Sets the year value.

Definition at line 102 of file ezdate.php.

Referenced by __construct(), setMySQLDate(), and setTimeStamp().

## ◆ timeStamp()

eZDate::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 182 of file ezdate.php.

References day(), month(), and year().

## ◆ year()

eZDate::year | ( |  | ) |

The year is returned in Y2K compatible format.

Definition at line 78 of file ezdate.php.

References $Year.

Referenced by timeStamp().

## Member Data Documentation

## ◆ $Day

eZDate::$Day

Definition at line 516 of file ezdate.php.

Referenced by day().

## ◆ $Month

eZDate::$Month

Definition at line 515 of file ezdate.php.

Referenced by month().

## ◆ $Year

eZDate::$Year

Definition at line 514 of file ezdate.php.

Referenced by mySQLDate(), and year().

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

- ezdate.php

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