Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Perhaps this answers your question</p> <p><a href="http://www.epochconverter.com/programming/functions-php.php" rel="noreferrer">http://www.epochconverter.com/programming/functions-php.php</a></p> <p>Here is the content of the link:</p> <p>There are many options:</p> <ol> <li>Using 'strtotime':</li> </ol> <p>strtotime parses most English language date texts to epoch/Unix Time.</p> <pre><code>echo strtotime("15 November 2012"); // ... or ... echo strtotime("2012/11/15"); // ... or ... echo strtotime("+10 days"); // 10 days from now </code></pre> <p>It's important to check if the conversion was successful:</p> <pre><code>// PHP 5.1.0 or higher, earlier versions check: strtotime($string)) === -1 if ((strtotime("this is no date")) === false) { echo 'failed'; } </code></pre> <p>2. Using the DateTime class:</p> <p>The PHP 5 DateTime class is nicer to use:</p> <pre><code>// object oriented $date = new DateTime('01/15/2010'); // format: MM/DD/YYYY echo $date-&gt;format('U'); // or procedural $date = date_create('01/15/2010'); echo date_format($date, 'U'); </code></pre> <p>The date format 'U' converts the date to a UNIX timestamp.</p> <ol start="3"> <li>Using 'mktime':</li> </ol> <p>This version is more of a hassle but works on any PHP version.</p> <pre><code>// PHP 5.1+ date_default_timezone_set('UTC'); // optional mktime ( $hour, $minute, $second, $month, $day, $year ); // before PHP 5.1 mktime ( $hour, $minute, $second, $month, $day, $year, $is_dst ); // $is_dst : 1 = daylight savings time (DST), 0 = no DST , -1 (default) = auto // example: generate epoch for Jan 1, 2000 (all PHP versions) echo mktime(0, 0, 0, 1, 1, 2000); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload