Details
Date-Validator
Validation of format is right for given datetime,date or time string variable.
Acronym: [Date-Validator].
Name: Date-Validator.
Dependencies: Stand Alone / PHP v7.4.
What does [Date-Validator] do?
is a very simple PHP [Date-Validator] implementation that allows you to easily validate if the PHP variable passed is a string with valid datetime, date, time format.
Why use [Date-Validator]?
Developers need the ability to validate if variable meaning a datetime, date or time have a right format, this helps to validate some format dependencies that must have a datetime, date or time string.
Help to improve [Date-Validator]?
if you want to collaborate with the development of the library; You can express your ideas or report any situation related to this in:
https://github.com/arcanisgk/Date-Validator/issues
[Date-Validator] Configuration:
None necessary.
[Date-Validator] Installation:
composer require arcanisgk/date-validator
[Date-Validator] Usage:
Instance of Class:
use IcarosNet\DateValidator\DateValidator;
require __DIR__.'\..\vendor\autoload.php';
$date_validator = new DateValidator();
Implementation of Class:
if ($date_validator->ValidateDate('10/10/1999 20:40')) {
echo 'Correct date string';
}
if ($date_validator->ValidateDate('XXX10/10/1999 20:40')) {
echo 'incorrect date string';
}
if($date_validator->addFormat('d--m--Y H%i')->ValidateDate('09--09--2010 20%40')){
echo 'Correct new date format string using % separator';
}
Contributors
-
(c) 2020 - 2022 Walter Francisco Núñez Cruz
icarosnet@gmail.com
|
Name: |
How Can PHP Validate Date According to Valid Date Formats using Date Validator |
Base name: |
date-validator |
Description: |
Validate strings with dates to match a format |
Version: |
1.0 |
PHP version: |
7.4 |
License: |
MIT/X Consortium License |
All time users: |
84 users |
All time rank: |
9929 |
Week users: |
1 user |
Week rank: |
257  |
|
|
 November 2022
Number 2 |
Many applications take input parameters from users or other external data sources, including dates or times.
When the applications allow multiple formats for the date and time values they accept as parameters, they must check them against all the acceptable date and time formats.
This package can perform date and time validation that accepts many possible formats and can even support more custom date and time formats.
Manuel Lemos |
Not yet rated by the users |
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.
|
Files |
|
File |
Role |
Description |
index.php |
Example |
Example script |
|
Files |
|
File |
Role |
Description |
index.php |
Example |
Example script |