Skip to content

Instantly share code, notes, and snippets.

@akroii
Created February 2, 2017 09:56
Show Gist options
  • Select an option

  • Save akroii/4dfd6b41eadfd8c99c742231c016a403 to your computer and use it in GitHub Desktop.

Select an option

Save akroii/4dfd6b41eadfd8c99c742231c016a403 to your computer and use it in GitHub Desktop.
php date calculation for jquery for contao
<?php $finalRawDate = $this->parseDate('Y/m/d H:i:s',strtotime($this->value));?>
<?php $finalDateC = date('c', strtotime($finalRawDate));?>
<?php $finalDateStr = date('Y-m-d', strtotime($finalRawDate));?>
<?php $finalDate = date('Y-m-d\TH:i', strtotime($finalRawDate));?>
<?php $passedRawDate = date("Y-m-d H:i:s", strtotime($finalRawDate . "+240 minutes"));?>
<?php $passedDateC = date('c', strtotime($passedRawDate));?>
<?php $passedDate = date('Y-m-d\TH:i', strtotime($passedRawDate));?>
<?php
$timestamp = strtotime("'.$finalDateStr.'");// your launch date '2020-07-30'
$difference = $timestamp + time();
$passedDateMs = ($difference * 1000);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment