Welcome Guest, Not a member yet? Register   Sign In
DateTime php function causing error
#2

(This post was last modified: 05-26-2020, 06:06 AM by dave friend.)

It's probably a namespace issue. Make sure to specify the "global" namespace for the DateTime class by preceding it with a \

PHP Code:
$date1 = new \DateTime($dobStr);  \\see the backslash
$date2 $date1->diff(new \DateTime(\date('m/d/Y', \time())));

echo 
$date2->y
Reply


Messages In This Thread
DateTime php function causing error - by kick - 05-24-2020, 11:10 AM
RE: DateTime php function causing error - by dave friend - 05-24-2020, 04:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB