note 85850 modified in function.date by danbrown

From: Date: Sat, 20 Sep 2008 20:41:24 +0000
Subject: note 85850 modified in function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-144580@lists.php.net to get a copy of this message
The following is a function that will convert Unix Epoch to date format string. <?PHP // Function by Jonathan C Newcomb function unix_to_date($date_format, $unix_epoch){ // Get current server GMT $gmt = date('P'); $gmt_split = explode(':', $gmt); $gmt_offset = $gmt_split[0]; $ret = date($date_format, mktime(0 + ($gmt_offset),0, $unix_epoch, 1, 1, 1970)); return $ret; } ?> --was-- The following is a function that will convert Unix Epoch to date format string. <?PHP // Function by Jonathan C Newcomb function unix_to_date($date_format, $unix_epoch){ // Get current server GMT $gmt = date('P'); $gmt_split = explode(':', $gmt); $gmt_offset = $gmt_split[0]; $ret = date($date_format, mktime(0 + ($gmt_offset),0, $unix_epoch, 1, 1, 1970)); return $ret; } http://php.net/manual/en/function.date.php

« previous php.notes (#144580) next »