You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
616 B

<?php
namespace app\core\utils;
class Helper {
public static function date($date) {
if (is_null($date))
return false;
$date = \DateTime::createFromFormat('m/d/Y', $date);
if (!$date)
return false; // throw new \Exception("Invalid date format!");
return $date->format('Y-m-d');
}
public static function ucWords(string $str) {
return mb_convert_case(mb_strtolower($str, 'UTF-8'), MB_CASE_TITLE, "UTF-8");
}
public static function lowerCase(string $str) {
return mb_strtolower(utf8_encode($str), 'UTF-8');
}
}