Creating DateTime Objects
DateTime objects can be created using different formats.
Current date and time
Section titled “Current date and time”$date = new DateTime();Specific date
Section titled “Specific date”$date = new DateTime("2025-06-10");With timezone
Section titled “With timezone”$date = new DateTime("now", new DateTimeZone("UTC"));