Date format problem with field default value

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sclg
User
Posts: 149
Location: UK

Date format problem with field default value

Post by sclg »

I have an application that I'm updateing to 2024. It uses en-GB language and d/m/y date format. Everything works fine - all the dates are displayed correctly.

However in one table, I have a default date set in the Add Page section of Fields.
In the earlier version, this is set to date("d/m/Y") and works correctly - but this throws an error in 2024. To get it to work in 2024, I find I have to use date("m/d/Y") as the default value despite EVERYTHING else in the application using UK date format.
Why is this?


arbei
User
Posts: 9384

Post by arbei »

That is because the script will try to convert your input string (note that date("d/m/Y") returns string) to date by DateTimeImmutable, see Supported Date and Time Formats. If you just want to set default value as today, you may try to enter "today" (with quotes).


sclg
User
Posts: 149
Location: UK

Post by sclg »

Thank you


Post Reply