Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

validateDatetime()

Description

Utility function to check string is a valid date/time

Parameters

ColumnTypeDefaultDescription
$datestring string - date string
$format string 'Y-m-d H:i:s' - DateTime format to compare

Return

boolean

Location

include/migration_functions.php lines 286 to 290

Definition

 
function validateDatetime($datestring$format 'Y-m-d H:i:s')
    {
    
$date DateTime::createFromFormat($format$datestring);
    return 
$date && $date->format($format) == $datestring;
    }

This article was last updated 7th July 2020 09:35 Europe/London time based on the source file dated 24th June 2020 15:23 Europe/London time.