note 49834 deleted from function.mktime by derick
| From: | derick@php.net | Date: | Sun, 24 Sep 2006 12:02:36 +0000 |
| Subject: | note 49834 deleted from function.mktime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117521@lists.php.net to get a copy of this message | ||
Note Submitter: kwillmert a visionaryweb dt com
----
A simpler version of the function below:
<?php
function dttm2unixtime( $dttm2timestamp_in )
{
// returns unix time stamp for a given date time string that comes from DB
list( $date, $time ) = split(" ", $dttm2timestamp_in);
list( $year, $month, $day ) = split( "-", $date );
list( $hour, $minute, $second ) = split( ":", $time );
return mktime( $hour, $minute, $second, $month, $day, $year );
}
?>
You don't need to run intval on each string, mktime knows what they are and will do that behind
the scenes.