48 Views
2018 Jul 21Trainingtechnology
img

The Unix time (or Unix epoch or POSIX time or Unix timestamp) is a system for describing points in time, defined as the number of seconds elapsed since January 1, 1970 00:00 UTC. not counting leap seconds.

To get current epoch time in PHP
use time() function.

Convert from epoch to human readable date in PHP
Use codes below :
$Timezone = 'Europe/London';
$dt = new DateTime("@$Date");  // convert UNIX timestamp to PHP DateTime
$dt->setTimeZone(new DateTimeZone($Timezone));
$date =  $dt->format('Y-M-d');
Note : Replace Timezone with your prefered one.

Convert from human readable date to epoch in PHP
Use sample codes below :
strtotime("2018/07/21");
strtotime("2018/07/21 23:59:59");

php

epoch

epoch date

epoch time

epoch timestamp

unix timestamp

use epoch in php

epoch in php