note 81590 added to function.mktime
| From: | blackdog at osu1 dot php dot net | Date: | Wed, 05 Mar 2008 09:45:43 +0000 |
| Subject: | note 81590 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136756@lists.php.net to get a copy of this message | ||
Converting date() style strings to unix epoch time was giving me an "A non well formed numeric
value encountered in" error. Simply resolved with an (int) call on the string:
<?php
$ue_time = time();
$old_date = date('Y-m-d');
$old_time = date('h:i');
$new_date = str_replace('-', ', ', $old_date);
$new_time = str_replace(':', ', ', $old_time);
$convert_date = $new_time.', '.$new_date;
$convert_date = (int)$convert_date;
$converted = mktime ($convert_date);
echo $ue_time.' vs '.$old_date.' '.$old_time.' converted =
'.$converted;
?>
----
Server IP: 92.48.74.199
Probable Submitter: 86.142.31.117
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit -- https://master.php.net/note/edit/81590
Del: integrated -- https://master.php.net/note/delete/81590/integrated
Del: useless -- https://master.php.net/note/delete/81590/useless
Del: bad code -- https://master.php.net/note/delete/81590/bad+code
Del: spam -- https://master.php.net/note/delete/81590/spam
Del: non-english -- https://master.php.net/note/delete/81590/non-english
Del: in docs -- https://master.php.net/note/delete/81590/in+docs
Del: other reasons-- https://master.php.net/note/delete/81590
Reject -- https://master.php.net/note/reject/81590
Search -- https://master.php.net/manage/user-notes.php