CopyPastehas never been so tasty!

Calculate date interval with epoch timestamps in PHP

by anonymous

  • 0
  • 0
  • 0
63 views

orignal source:http://codingvilla.com/calculate-date-interval-epoch-timestamp-php-single-article-568.aspx

Epoch Timestamp:

 

Epoch – Pronounced as EH-puhk, it is a Greek word, which means "fixed point in time. Epoch is the date and time calculated relative to your computer's clock and timestamp. It is represented as (00:00:00).

 

Date Interval with Epoch Timestamp in PHP:

 

To calculate date interval using epoch timestamp in php, we take a variable birthday and assign a value to that variable.We will take one more variable gestation that will perform 36 week days calculation.

 

 

Code:

 

<?php

$birthday = 163727100;

$gestation = 36 * 7 * 86400; // 36 weeks

$whoopee_made = $birthday - $gestation;

echo “$whoopee_made”;

?>

 

 

Above is the simple code to calculate date interval using epoch timestamp in PHP.

 

This simple article tells that how we can calculate date in epoch timestamp in PHP.

 

 

Add A Comment: