• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP DateTime class not found

#1
Hi,

Error
Class 'App\Controller\DateTime' not found


PHP Code:
$start = new DateTime($this->request->getPost('start_date'));
$end = new DateTime($this->request->getPost('end_date'));
$end $end->modify'+1 day' );
$interval = new DateInterval('P1D'); 

Correct me if I'm wrong but isn't DateTime class is built-in PHP 7? But codeigniter 4 cannot find the class.

Thank you for helping..
Reply

#2
You need to add a \ in front of native php functions.

\DateTime instead of DateTime
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme ¬© 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.