Hi,
I need to convert a date to a timestamp.
e.g. 23/01/2006 into a unix timestamp.
Is there a function that can do this?
Hi,
I need to convert a date to a timestamp.
e.g. 23/01/2006 into a unix timestamp.
Is there a function that can do this?
I have just found out how to do it using strtotime().
However, is there a way I can alter the date format it expects? (i.e. to UK English format?)
This page shows the different formats strtotime() will work with. To convert to one of those (or a few other unlisted ones; experiment) you can just do some simple string manipulation. Your example:
$date = '23/01/2006';
$date = str_replace('/', '-', $date);
$timestamp = strtotime($date);