In my previous project in old PHPMaker I use to create date by using
$newdate = DateTime::createFromFormat(‘d/m/Y’, $this->txddate->AdvancedSearch->SearchValue);
but in the latest version when I use it I got the error as
Fatal error: Class ‘PHPMaker2020\New_2020\DateTime’ not found
I phpmaker 2020 the date is created as new \DateTime()
but How can I create the date using the createFromFormat in the new version
I try as
$newdate = new \DateTime::createFromFormat(‘d/m/Y’, $this->txddate->AdvancedSearch->SearchValue);
$newdate = new \DateTime()createFromFormat(‘d/m/Y’, $this->txddate->AdvancedSearch->SearchValue);
The first argument of createFromFormat() is format, see: https://www.php.net/manual/en/datetime.createfromformat.php. Since the search value follows the format you specify in the View Tag or locale file, you should specify the same format when you call createFromFormat() so the search value can be parsed correctly.