Get the date and time in unix time

There is a date and time, for example 08.06.2013 15:40.

How can I get the unix time of this date using PHP?

Author: AntonioK, 2013-06-05

3 answers

$date = '2016-05-24 16:32:45';
$timestamp = strtotime($date);
 5
Author: RaZik, 2016-08-05 07:12:23

You can use the function getTimestamp (documentation)

 1
Author: zb', 2017-06-17 14:38:07

Rather, you should do this:

$date = '2016-05-24 16:32:45';

$timestamp = strtotime($date);

In the example above, an error is made, instead of strtotime($date), the function call strtotime() is specified without the variable $date.

 0
Author: Artem S Ko, 2017-04-04 21:59:42