php year to timestamp code example Example: php datetime to timestamp $time = '2021-03-31 23:59:00'; strtotime($time);