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

stepassia's avatar

After date validation

Hi to all, I need to validate a date attribute with after clause. I've: $date1 from request with this format: 2016-03-30T00:00:00 $date2 from db with this format: 29-03-2016 (d-m-Y)

This my rules: $rules = array( 'date1' => 'required|date|after:' . $date2formatted );

where date2formatted is strtotime(\DateTime::createFromFormat('d-m-Y', $date2)->format('m/d/Y')) But every time validation fail the after condition. Any suggestions? Thanks a lot

0 likes
0 replies

Please or to participate in this conversation.