CodeIgniter: malformed numeric value encountered
2 answers
Anything you code correctly. problem with +2weeks
. When you use a function strtotime()
, you need to keep <space>
between text (+2<SPACE>weeks)
.
Examples ( from W3Schools )
<?php
echo(strtotime("now") . "<br>");
echo(strtotime("3 October 2005") . "<br>");
echo(strtotime("+5 hours") . "<br>");
echo(strtotime("+1 week") . "<br>");
echo(strtotime("+1 week 3 days 7 hours 5 seconds") . "<br>");
echo(strtotime("next Monday") . "<br>");
echo(strtotime("last Sunday"));
?>
So the code for your final form is
$expire_datetime = date('g:ia \o\n l jS F Y',strtotime($row->created, "+2 weeks"));
0
source to share
strtotime()
requires a relative date format in the first argument. The second argument is optional and can be a unix timestamp.
0
source to share