Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Richard Trussler
Added: Mar 17, 2018 12:25 PM
Modified: Mar 17, 2018 12:37 PM
Views: 9
Tags: no tags
  1. public function createTime($date, $format=""){
  2.             if ($format==""){
  3.                 list($day,$month,$year) = explode("/",$date);
  4.                 $unix = mktime(0,0,0,(int)$month,(int)$day,(int)$year);
  5.             }
  6.             elseif($format=="Y-m-d"){
  7.                 list($year,$month,$day) = explode("-",$date);
  8.                 $unix = strtotime($day."-".$month."-".$year);
  9.             }
  10.             return $unix;
  11.         }