Files
dolibarr/htdocs/lib/date.lib.php
2008-03-02 18:47:42 +00:00

66 lines
1.7 KiB
PHP

<?php
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*/
/**
\file htdocs/lib/date.lib.php
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
\version $Id$
*/
/** \brief Return previous month
* \param month Month
* \param year Year
* \return array Previous year,month
*/
function dol_get_prev_month($month, $year)
{
if ($month == 1)
{
$prev_month = 12;
$prev_year = $year - 1;
}
else
{
$prev_month = $month-1;
$prev_year = $year;
}
return array('year' => $prev_year, 'month' => $prev_month);
}
/** \brief Return next month
* \param month Month
* \param year Year
* \return array Next year,mont
*/
function dol_get_next_month ($month, $year)
{
if ($month == 12)
{
$next_month = 1;
$next_year = $year + 1;
}
else
{
$next_month = $month + 1;
$next_year = $year;
}
return array('year' => $next_year, 'month' => $next_month);
}
?>