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 ?>
Commentaires récents