I have the following string: 2013-03-22
I need to convert that to a UNIX Timestamp.
How do I do this using PHP?
I have the following string: 2013-03-22
I need to convert that to a UNIX Timestamp.
How do I do this using PHP?
With DateTime class
$dateTime = DateTime::createFromFormat('Y-m-d', '2013-03-22');
$dateTime->setTime(0, 0, 0);
echo $dateTime->getTimestamp();
Using
strtotime("2013-03-22")
It will convert the date sting into timestamp value.