My PHP datetime code doesn't work properly

Viewed 46

The code shown below isn't working properly, can you tell me why that is? My web browser shows a 504 error when loading the script.

I tried many ways to fix it. It just cannot access any datetime object. Even though I copy the code from php manual.

Is there another way, I could possibly write this line like?

<?php
        
$start = new DateTime('2012-07-01');
?>

Thanks in advance.

1 Answers

Create a DateTimeImmutable Object is ok

$date = new DateTimeImmutable('2000-01-01');
Related