DateTime createFromFormat is not working

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);

PHPMaker 2020 is now namespaced. Try: \DateTime

arbei wrote:

PHPMaker 2020 is now namespaced. Try: \DateTime

my date in the format d/m/Y as 10/05/2020
I would like to create the datetime using the createFromFormat

I try as
$newdate = new \DateTime($this->txddate->AdvancedSearch->SearchValue);
but the above code is accepting as m/d/Y

Now how can I create the DateTime using the createFromFormat

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.