iflrandevu/application/helpers/validation_helper.php

27 lines
841 B
PHP
Raw Normal View History

<?php defined('BASEPATH') or exit('No direct script access allowed');
2015-10-18 20:48:39 +03:00
/* ----------------------------------------------------------------------------
2022-01-18 15:05:42 +03:00
* Easy!Appointments - Online Appointment Scheduler
2015-10-18 20:48:39 +03:00
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
2021-12-18 19:43:45 +03:00
* @copyright Copyright (c) Alex Tselegidis
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
* @link https://easyappointments.org
2015-10-18 20:48:39 +03:00
* @since v1.0.0
* ---------------------------------------------------------------------------- */
/**
* Validate a date time value.
2015-10-18 20:48:39 +03:00
*
* @param string $value Validation value.
2020-12-05 12:55:20 +03:00
*
2015-10-18 20:48:39 +03:00
* @return bool Returns the validation result.
*/
function validate_datetime(string $value): bool
{
$date_time = DateTime::createFromFormat('Y-m-d H:i:s', $value);
2020-12-05 12:55:20 +03:00
return (bool)$date_time;
2015-10-18 20:48:39 +03:00
}