1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71:
<?php
class PHPShopDate {
static function get($nowtime = false, $full = false, $revers = false, $delim = '-', $months_enabled = false) {
return PHPShopDate::dataV($nowtime, $full, $revers, $delim, $months_enabled);
}
static function dataV($nowtime = false, $full = true, $revers = false, $delim = '-', $months_enabled = false) {
if (empty($nowtime))
$nowtime = date("U");
$Months = array("01" => "", "02" => "", "03" => "",
"04" => "", "05" => "", "06" => "", "07" => "",
"08" => "", "09" => "", "10" => "",
"11" => "", "12" => "");
$d_array = array(
'y' => date("Y", $nowtime),
'm' => date("m", $nowtime),
'd' => date("d", $nowtime),
'h' => date("h:i", $nowtime)
);
if ($months_enabled)
$d_array['m'] = $Months[$d_array['m']];
if (!empty($revers))
$time = $d_array['y'] . $delim . $d_array['m'] . $delim . $d_array['d'];
else
$time = $d_array['d'] . $delim . $d_array['m'] . $delim . $d_array['y'];
if (!empty($full))
$time.=" " . $d_array['h'];
return $time;
}
static function GetUnixTime($data, $delim = '-') {
$array = explode($delim, $data);
return @mktime(12, 0, 0, $array[1], $array[0], $array[2]);
}
}
?>