Hi,
If you have a DateTimeImmutable, you can modify and return new DateTimeImmutable for comparison without leek the initial date. Is not specific for Symfony. Is simple a PHP with DateTime* classes comparison.
You can save the margin in constant.
Décrivez ici votre problème ou ce que vous cherchez à faire.
Hello everyone,
I have a problem in Symfony6 for compare 2 dates.
I have an entity Reservation
Inside i have two dateTime.
The first : createdAt : $createdAt : DateTimeImmutable
The second : date : $date : DateTime
I would like to create a function who compare $createdAt & $date and return a message if $date > $createdAt + 60 Days
I have search on the web and symfony doc, but i'm new and i have some problem to understand how it works. Please i need help for create this function.
Thank's in advance for your answers
Hi,
If you have a DateTimeImmutable, you can modify and return new DateTimeImmutable for comparison without leek the initial date. Is not specific for Symfony. Is simple a PHP with DateTime* classes comparison.
You can save the margin in constant.