note 81590 deleted from function.mktime by derick
| From: | derick@php.net | Date: | Sat, 26 Jul 2008 10:06:57 +0000 |
| Subject: | note 81590 deleted from function.mktime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142777@lists.php.net to get a copy of this message | ||
Note Submitter: blackdog
----
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;
?>