Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php validate date format

$date="2012-09-12";

if (preg_match("/^(20[0-9]{2})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$date)) {
    return true;
} else {
    return false;
}
Comment

php check valid time format

function isValidDate(string $date, string $format = 'Y-m-d'): bool
{
    $dateObj = DateTime::createFromFormat($format, $date);
    return $dateObj && $dateObj->format($format) == $date;
}
Comment

PREVIOUS NEXT
Code Example
Php :: string convert snake case to title case in laravel 
Php :: convert single quote in htmlentities php 
Php :: xampp to test on mobile 
Php :: php switch case multiple values per line 
Php :: base64 enocode php 
Php :: stripslashes in php 
Php :: curl php 
Php :: twig for loop key 
Php :: laravel range query 
Php :: How to check if email exists in laravel validaton 
Php :: how to create controller inside folder in laravel 
Php :: how to submit same form for different purpose using two submit button in php 
Php :: prettier with php 
Php :: show time laravel 
Php :: PHP print — Output a string 
Php :: laravel 8 try catch 
Php :: HTML5 Date Valu In PHP 
Php :: phpspreadsheet set cell by column and row 
Php :: laravel query builder select first 
Php :: Notice: Undefined variable: _SESSION in C:xampphtdocspracticeheader.php on line 7 
Php :: twig or 
Php :: wordpress get local date 
Php :: php string to uppercase 
Php :: laravel create model and migration 
Php :: dynamic base url codeigniter 
Php :: php read sql 
Php :: how unique field in table in phpmyadmin 
Php :: nginx 404 not found laravel 
Php :: convert php to python online 
Php :: how to write javascript inside php 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =