4

I'm working with CI and it is successfully echoing the proper expire date, but I am also getting this error:

A non well formed numeric value encountered

    $expire_datetime = date('g:ia \o\n l jS F Y',strtotime($row->created, "+2weeks"));  
    echo $expire_datetime;
Dan Henry
  • 69
  • 5

2 Answers2

0

All you coding is correct. problem is with +2weeks. When you use strtotime() function you need to keep <space> on 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 your Final Well form code is

$expire_datetime = date('g:ia \o\n l jS F Y',strtotime($row->created, "+2 weeks"));
Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
0

strtotime() function requires relative date format in first argument. Second argument is optional and can be unix time stamp.

Tpojka
  • 6,996
  • 2
  • 29
  • 39