2020-04-22 22:48:56 +03:00
|
|
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
2015-10-18 20:48:39 +03:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Easy!Appointments - Open Source Web Scheduler
|
|
|
|
*
|
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2020-03-11 12:10:59 +03:00
|
|
|
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
2015-10-18 20:48:39 +03:00
|
|
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link http://easyappointments.org
|
|
|
|
* @since v1.0.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/**
|
2020-12-05 12:55:20 +03:00
|
|
|
* Check if a string date is valid for insertion or update to the database.
|
2015-10-18 20:48:39 +03:00
|
|
|
*
|
|
|
|
* @param string $datetime The given date.
|
2020-12-05 12:55:20 +03:00
|
|
|
*
|
2015-10-18 20:48:39 +03:00
|
|
|
* @return bool Returns the validation result.
|
|
|
|
*
|
|
|
|
* @link http://stackoverflow.com/a/8105844/1718162 [SOURCE]
|
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
function validate_mysql_datetime($datetime)
|
|
|
|
{
|
2015-10-18 20:48:39 +03:00
|
|
|
$dt = DateTime::createFromFormat('Y-m-d H:i:s', $datetime);
|
2020-12-05 12:55:20 +03:00
|
|
|
|
2020-04-22 22:48:56 +03:00
|
|
|
return $dt ? TRUE : FALSE;
|
2015-10-18 20:48:39 +03:00
|
|
|
}
|