PHP code example of empathy / yii2-datetime-compare
1. Go to this page and download the library: Download empathy/yii2-datetime-compare library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
empathy / yii2-datetime-compare example snippets
[
// validates if the value of "birthday" attribute equals to that of "birthday_repeat"
['birthday', DateTimeCompareValidator::className()],
// validates if birthday is less than or equal to today
['birthday', DateTimeCompareValidator::className(), 'compareValue' => date('Y-m-d H:i:s'), 'operator' => '<='],
// validates if birthday is less than driver's license expiry
['birthday', DateTimeCompareValidator::className(), 'compareAttribute' => 'driver_license_expiry', 'operator' => '<'],
]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.