Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

karimali1337's avatar

Date/Time inputs dynamic

i've form has 2 inputs date/time but its static i have an idea but don't know if its applicable or not.

i want the 2 inputs have default now();

if the didn't change its value it stored to db with the now(); date and time,

but if he changed it to another date and time the stored value be his choice,

is this can be done ?

0 likes
3 replies
undeportedmexican's avatar
Level 15

I'm assuming you're using Blade templates here?

If that's the case, then you can just use now() helper function to make this work. Something like this:

<input type="date" value="{{ now()->format('Y-m-d') }}">

Please or to participate in this conversation.