First of all, you need to determine if your date represented by “YYYYMMDDHHMMSS” is local or GMT. For example, DreamHost’s MySQL servers are in California - and so the date will be local to the Pacific timezone.
Now second, get the parts into variables: $hour, $minutes, $seconds, $month, $date, $year.
Then if the date was GMT -
$unix_timestamp = gmmktime($hour, $minutes, $seconds, $month, $date, $year);
If the date was local -
$unix_timestamp = mktime($hour, $minutes, $seconds, $month, $date, $year);
You can skip the gmdate(“U”, $timestamp) call.
If you are getting the timestamp from a MySQL database, then there is a MySQL function to do this for you -
SELECT UNIX_TIMESTAMP(timestamp) AS `unix_timestamp` ...Also, if you insert dates into a database, make sure they are translated to the same timezone as the server. For example, if you had a UNIX timestamp, to insert it into the database:
INSERT timestamp=FROM_UNIXTIME($unix_timestamp) ...Otherwise, in PHP, you’d have to do:
Hope this helps the problem with the gaps.