Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Format a Unix timestamp
<?php date(string $format, ?int $timestamp = null): string
<?php     protected function getDatePrefix()

    {

        return date('Y_m_d_His');

    }
<?php         $trans = $this->getIlluminateArrayTranslator();

        $trans->addLines(['validation.date_equals' => 'The :attribute must be a date equal to :date.'], 'en');

        $trans->addLines(['validation.values.date.tomorrow' => 'the day after today'], 'en');

        $v = new Validator($trans, ['date' => date('Y-m-d')], ['date' => 'date_equals:tomorrow']);

        $this->assertFalse($v->passes());

        $v->messages()->setFormat(':message');

        $this->assertSame('The date must be a date equal to the day after today.', $v->messages()->first('date'));
<?php         $v = new Validator($trans, ['start' => new DateTime('2000-01-01'), 'ends' => new DateTime('2000-01-01')], ['ends' => 'date_equals:start']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'date_equals:today']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'date_equals:yesterday']);
<?php         $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'date_equals:today']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'date_equals:yesterday']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'date_equals:tomorrow']);
<?php         $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'date_equals:yesterday']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'date_equals:tomorrow']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|date_equals:today']);
<?php         $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'date_equals:tomorrow']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|date_equals:today']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|date_equals:yesterday']);
<?php         $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|date_equals:today']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|date_equals:yesterday']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|date_equals:tomorrow']);
<?php         $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|date_equals:yesterday']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|date_equals:tomorrow']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => '2012-01-01 17:44:00'], ['x' => 'date_format:Y-m-d H:i:s|date_equals:2012-01-01 17:44:00']);
<?php         $v = new Validator($trans, ['start' => '31/12/2012', 'ends' => null], ['start' => 'before:ends', 'ends' => 'nullable']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|after:yesterday|before:tomorrow']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|after:today']);
<?php         $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|after:yesterday|before:tomorrow']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|after:today']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|before:today']);
<?php         $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|after:today']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|before:today']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'after:yesterday|before:tomorrow']);
<?php         $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|before:today']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'after:yesterday|before:tomorrow']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'after:today']);
<?php         $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'after:yesterday|before:tomorrow']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'after:today']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'before:today']);
<?php         $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'after:today']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('Y-m-d')], ['x' => 'before:today']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => '2012-01-01 17:44:00'], ['x' => 'date_format:Y-m-d H:i:s|before:2012-01-01 17:44:01|after:2012-01-01 17:43:59']);
<?php         $v = new Validator($trans, ['x' => '15/01/2012'], ['x' => 'date_format:d/m/Y|before_or_equal:14/01/2012']);

        $this->assertTrue($v->fails());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|before_or_equal:today']);

        $this->assertTrue($v->passes());



        $v = new Validator($trans, ['x' => date('d/m/Y')], ['x' => 'date_format:d/m/Y|before_or_equal:tomorrow']);