Posts Under 'Date'

To parse a date which may be delimited with slashes, dots, or hyphens:

<?php // Delimiters may be slash, dot, or hyphen $date = "04/30/1973"; list($month, $day, $year) = split('[/.-]', $date); echo "Month: $month; Day: $day; Year: $year \n"; ?>

Read more »


How can we know the number of days between two given dates using PHP?

$date1 = date('Y-m-d'); $date2 = '2009-11-01'; $days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24); echo "Number of days since '2006-07-01': $days";

Read more »