Description
Fonction retournant le nombre de jours dans un mois.
Source
<?php
/**
* Fonction retournant le nombre de jours dans un mois.
* @param integer $month Mois de 1 à 12
* @param integer $year Année
* @return integer Nombre de jours
*/
function maxDaysInMonth($month, $year)
{
$days = cal_days_in_month(CAL_GREGORIAN, $month, $year);
return $days;
}
?>
Exemple
<?php
echo maxDaysInMonth(02, 2012); // Affiche 29
?>
Source
Télécharger la source
Description
Fonction de conversion de date du format français (JJ/MM/AAAA) en Timestamp.
Source
<?php
/**
* Fonction de conversion de date du format français (JJ/MM/AAAA) en Timestamp.
* @param string $date Date au format français (JJ/MM/AAAA)
* @return integer Timestamp en seconde
*/
function dateFR2Time($date)
{
list($day, $month, $year) = explode('/', $date);
$timestamp = mktime(0, 0, 0, $month, $day, $year);
return $timestamp;
}
?>
Exemple
<?php
echo dateFR2Time('16/01/1987'); // Affiche 537750000
?>
Source
Télécharger la source
Description
Fonction de conversion de date du format américain (AAAA-MM-JJ) en Timestamp.
Source
<?php
/**
* Fonction de conversion de date du format américain (AAAA-MM-JJ) en Timestamp.
* @param string $date Date au format américain (AAAA-MM-JJ)
* @return integer Timestamp en seconde
*/
function dateUS2Timestamp($date)
{
list($year, $month, $day) = explode('-', $date);
$timestamp = mktime(0, 0, 0, $month, $day, $year);
return $timestamp;
}
?>
Exemple
<?php
echo dateUS2Timestamp('1987-01-16'); // Affiche 537750000
?>
Source
Télécharger la source
Commentaires récents