From: Leandro Lucarella Date: Mon, 12 Jan 2004 19:25:10 +0000 (+0000) Subject: Date con métodos extra de Date_Calc. X-Git-Tag: svn_import~141 X-Git-Url: https://git.llucax.com/mecon/meconlib.git/commitdiff_plain/24dc627d5853b03b13c9506e6a7914e6f84a25cd?ds=sidebyside Date con métodos extra de Date_Calc. --- diff --git a/lib/MECON/Date.php b/lib/MECON/Date.php new file mode 100644 index 0000000..8f026a5 --- /dev/null +++ b/lib/MECON/Date.php @@ -0,0 +1,87 @@ + +------------------------------------------------------------------------------- +$Id: DBO.php 361 2003-10-06 16:56:46Z llucar $ +-----------------------------------------------------------------------------*/ + +require_once 'Date.php'; +require_once 'Date/Calc.php'; + +/** + * Clase de manejo de fechas con algunos extra features. + * + * @access public + */ +class MECON_Date extends Date { + + /** + * Obtiene la fecha de inicio del próximo mes. + * + * @return MECON_Date. + * @access public + */ + function getBeginOfNextMonth() + { + return new MECON_Date(Date_Calc::beginOfNextMonth( + $this->day, $this->month, $this->year, '%Y-%m-%d')); + } + + /** + * Obtiene la fecha de fin del próximo mes. + * + * @return MECON_Date. + * @access public + */ + function getEndOfNextMonth() + { + return new MECON_Date(Date_Calc::endOfNextMonth( + $this->day, $this->month, $this->year, '%Y-%m-%d')); + } + + /** + * Obtiene la fecha de inicio del mes anterior. + * + * @return MECON_Date. + * @access public + */ + function getBeginOfPrevMonth() + { + return new MECON_Date(Date_Calc::beginOfPrevMonth( + $this->day, $this->month, $this->year, '%Y-%m-%d')); + } + + /** + * Obtiene la fecha de fin del mes anterior. + * + * @return MECON_Date. + * @access public + */ + function getEndOfPrevMonth() + { + return new MECON_Date(Date_Calc::endOfPrevMonth( + $this->day, $this->month, $this->year, '%Y-%m-%d')); + } + +} + +?> \ No newline at end of file