Subversion Repositories Sites.tela-botanica.org

Compare Revisions

No changes between revisions

Ignore whitespace Rev 3 → Rev 4

/trunk/api/date/DAT_date.fonct.php
New file
0,0 → 1,143
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: DAT_date.fonct.php,v 1.1 2004/09/10 15:01:00 jpm Exp $
/**
* API : date.
*
* Cette librairie contient des fonctions dédiées à la gestion des dates :
* formatage, transformations, conversions...
*
*@package API
*@subpackage Date
//Auteur original :
*@author Jean-Charles GRANGER <tela@vecteur.org>
//Autres auteurs :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Jean-Pascal MILCENT <jpm@clapas.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2004/09/10 15:01:00 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici les inclusions de fichiers*/
 
// Compatibilité avec les anciennes versions :
/** FormateDateYYYYMMJJ() - Ancien nom de la fonction DAT_formaterDateYYYYMMJJ.
*
* Fontion obsolète! Veuiller utiliser DAT_formaterDateYYYYMMJJ().
*
* @param string date à formater.
* @return string date formatée.
*/
function FormateDateYYYYMMJJ($stamp_a_formater)
{
return DAT_formaterDateYYYYMMJJ($stamp_a_formater);
}
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
/*Mettre ici la liste de fonctions.*/
 
/** DAT_formaterDateYYYYMMJJ() - Formate en texte compréhensible une valeur au format yyyy.mm.jj
*
* Formate en texte compréhensible une valeur au format yyyy.mm.jj
* Exemples :
* - DAT_formaterDateYYYYMMJJ("1999"); --> "1999"
* - DAT_formaterDateYYYYMMJJ("1999.02"); --> "Février 1999"
* - DAT_formaterDateYYYYMMJJ("1999.11.03"); --> "3 Novembre 1999"
*
* @param string date à formater.
* @return string date formatée.
*/
function DAT_formaterDateYYYYMMJJ($stamp_a_formater)
{
ereg('[^0-9]', $stamp_a_formater, $chars);
if ($chars[0] == '') {
$chars[0] = '.';
}
$date_creation = explode($chars[0], $stamp_a_formater);
if (($date_creation[0] == 0) || (empty($date_creation[0]))) {
$date_creation[0] = '';
}
if (!empty($date_creation[1])){
switch($date_creation[1]){
case 1: $mois = 'Janvier ';
break;
case 2: $mois = 'Février ';
break;
case 3: $mois = 'Mars ';
break;
case 4: $mois = 'Avril ';
break;
case 5: $mois = 'Mai ';
break;
case 6: $mois = 'Juin';
break;
case 7: $mois = 'Juillet ';
break;
case 8: $mois = 'Août ';
break;
case 9: $mois = 'Septembre ';
break;
case 10: $mois = 'Octobre ';
break;
case 11: $mois = 'Novembre ';
break;
case 12: $mois = 'Décembre ';
break;
default: $mois = '';
}
} else {
$mois = '';
}
if (!empty($date_creation[2])){
if (($date_creation[2] == 0) || ($date_creation[2] == '')){
$jour = '';
} else {
$jour = $date_creation[2].' ';
}
} else{
$jour = '';
}
return $jour.$mois.$date_creation[0];
}
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
 
* $Log: DAT_date.fonct.php,v $
* Revision 1.1 2004/09/10 15:01:00 jpm
* Nouveau fichier remplaçeant lib.date.php.
* Contient des fonctions de manipulation de date.
*
*
* +--Fin du code ----------------------------------------------------------------------------------------+
*/
?>
Property changes:
Added: svn:executable
+*
\ No newline at end of property