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

AtomCoder's avatar

Date Validation - Format String ?

Hi Guys,

I'm validating date input like so

$today = Carbon::parse(Carbon::now())->addDays(1);

$this->validate(request(), [
    'date' => 'required|date|after:' . $today,
]);

The problem is that the validation error lang string displays the date format like this : 2019-09-07 11:39:02

Is there any way to format the error message string for the date output ?

0 likes
4 replies
Nakov's avatar
Nakov
Best Answer
Level 73

And why don't you use this instead:

this->validate(request(), [
    'date' => 'required|date|after:tomorrow'
]);

As essentially that's what you do. And for the format of the attributes take a look in the docs.

1 like
AtomCoder's avatar

Yes the :tomorrow would work too, thanks!

I'll take a look at the docs also.

Nakov's avatar

@atomcoder if the answer helped above, please consider marking it as a Best Answer. Thanks!

Please or to participate in this conversation.