Any way round the 1970 limitation for Date() on Windows?
Posted: Sat Dec 28, 2002 6:51 am
Hi,
I have dates stored as strings in a database in the format YYYYMMDD.
I use this so I can sort by date.
I want to display the dates in web pages and use
date("jS F, Y",strtotime($dob))
I need the Date() function to work on dates before 1970.
I've use the rather clumsy
$year = substr($dob,0,4);
if ($year < 1970) {
$dob = substr(date("jS F, Y",strtotime("2000" . substr($dob,4))),0,-4) . $year;
} else {
$dob = date("jS F, Y",strtotime($dob));
}
Is there an easier solution?
Thanks.
I have dates stored as strings in a database in the format YYYYMMDD.
I use this so I can sort by date.
I want to display the dates in web pages and use
date("jS F, Y",strtotime($dob))
I need the Date() function to work on dates before 1970.
I've use the rather clumsy
$year = substr($dob,0,4);
if ($year < 1970) {
$dob = substr(date("jS F, Y",strtotime("2000" . substr($dob,4))),0,-4) . $year;
} else {
$dob = date("jS F, Y",strtotime($dob));
}
Is there an easier solution?
Thanks.