Search
 
SCRIPT & CODE EXAMPLE
 

PHP

datetime validation in laravel

  return [
        'deadline' => 'required|date_format:Y-m-d H:i:s|after_or_equal:today',
    ];
Comment

Date time format for laravel validation

 $request->validate([
        'start_date' => 'date_format:d/m/Y',
        'end_date' => 'date_format:d/m/Y'
    ]);
Comment

laravel date validation

'dob' => 'required|date_format:Y-m-d|after_or_equal:1920-01-01'
Comment

datetime validation in laravel

  return [
        'deadline' => 'date_format:Y-m-d H:i:s'
    ];
Comment

Laravel validation date

'start_date' => 'required|date|after:tomorrow'
Comment

laravel validate date

 'day'            =>  'required|date',
Comment

laravel validation date time format

public function validateDate($attribute, $value)
 {
   if ($value instanceof DateTimeInterface) {
     return true;
   }

   if ((! is_string($value) && ! is_numeric($value)) || strtotime($value) === false) {
     return false;
   }

   $date = date_parse($value);

   return checkdate($date['month'], $date['day'], $date['year']);
 }

############## OR ###################

public function validateDateFormat($attribute, $value, $parameters)
{
  if (! is_string($value) && ! is_numeric($value)) {
    return false;
  }

  $format = $parameters[0];

  $date = DateTime::createFromFormat('!'.$format, $value);

  return $date && $date->format($format) == $value;
}
Comment

PREVIOUS NEXT
Code Example
Php :: redirect wordpress 
Php :: php current datettime us time zone 
Php :: how to add shortcode in html 
Php :: force https redirect php 
Php :: custom bootstrap pagination laravel 
Php :: php8.1 extensions 
Php :: Split 10 email out of 50 email using coma separated via php 
Php :: ipn listener paypel php 
Php :: oxygen upload font 
Php :: randomize question in laravel 
Php :: convert stdclass to json in php 
Php :: js change h1 value 
Php :: laravel end date greater than start date validation 
Php :: calcul age php datetime 
Php :: randomstring php 
Php :: how to get php version in xampp 
Php :: How to display data from MySQL database into HTML table using PHP 
Php :: php json hjeader 
Php :: php microtime 
Php :: php replace 
Php :: laravel optional route parameter in middle of url 
Php :: laravel exists validation query two tables 
Php :: encryp with codeigniter 3 
Php :: POP UP WITH PHP FUNCTION 
Php :: drupal 9 enable PHP errors 
Php :: php preg_replace whitespace 
Php :: php check if number starts with 0 
Php :: how to get all rows from a table except some rows in laravel 
Php :: php get last index end in foreach 
Php :: mac install multiple php versions 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =