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

As they said, it's a namespace issues. If your controller is namespaced as App\Controllers, then any new class you try to instantiate will assume it's in App\Controllers, also, which DateTime obviously isn't. So you have to tell PHP to look for it in the root namespace, by prefixing with the backslash.

Additionally - CI4 provides a new Time class that can do what you're wanting to do, and more.
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 kilishan - 05-25-2020, 08:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB