note 76849 modified in function.mktime by danbrown

From: Date: Sun, 20 Jul 2008 03:32:25 +0000
Subject: note 76849 modified in function.mktime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142071@lists.php.net to get a copy of this message
As per derrick miller's contribution for MySQL date stamps (which equally applies to pgSQL)... I find this processes a little faster than exploding the string: (All done in one statement) <?php function unix_date($input_date) { // take date string such as "1985-07-25" and return the Unix timestamp return mktime(0, 0, 0, substr($input_date, 5, 2), substr($input_date, 8, 2), substr($input_date, 0,4)); } ?> --was-- As per derrick miller's contribution for MySQL date stamps (which equally applies to pgSQL)... I find this processes a little faster than exploding the string: (All done in one statement) function unix_date($input_date) { // take date string such as "1985-07-25" and return the Unix timestamp return mktime(0, 0, 0, substr($input_date, 5, 2), substr($input_date, 8, 2), substr($input_date, 0,4)); } http://php.net/manual/en/function.mktime.php

« previous php.notes (#142071) next »