In this tutorial, we are going to see how to convert date to timestamp in PHP. You can use the PHP strtotime() function to convert any textual date to a Unix timestamp. The following example will show you how it works.
How to convert date to timestamp in PHP
<?php $date1 = "15-07-2021"; $timestamp1 = strtotime($date1); echo $timestamp1. '<br />'; $date2 = "2021-07-15"; $timestamp2 = strtotime($date2); echo $timestamp2. '<br />'; $date3 = "15 July 2021"; $timestamp3 = strtotime($date3); echo $timestamp3; ?>
1626321600 1626321600 1626321600