init commit
All checks were successful
build-api-image / build (push) Successful in 51s

This commit is contained in:
Antonio Lopes dos Santos
2026-08-04 16:52:02 -03:00
commit afec302c3e
11594 changed files with 1636728 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Utils;
use DateTime;
class DateTimeUtil
{
public static function isDate($string)
{
$string = str_replace('/', '-', $string);
$stamp = strtotime($string);
if (is_numeric($stamp)) {
$month = date('m', $stamp);
$day = date('d', $stamp);
$year = date('Y', $stamp);
return checkdate($month, $day, $year);
}
return false;
}
public static function isFormattedCorrectly($date, $format = 'Y-m-d H:i:s')
{
if (self::isDate($date)) {
$createdDate = DateTime::createFromFormat($format, $date);
return $createdDate && $createdDate->format($format) === $date;
}
return false;
}
}