note 49834 added to function.mktime
| From: | kwillmertavisionarywebdtcom at osu1 dot php dot net | Date: | Wed, 09 Feb 2005 22:47:54 +0000 |
| Subject: | note 49834 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84752@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49834
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49834&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49834&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49834&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49834&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49834&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49834&report=yes
Search -- http://master.php.net/manage/user-notes.php