erp/app/Utils/DateTimeUtils.php

35 lines
717 B
PHP
Raw Normal View History

2022-08-09 10:34:36 +08:00
<?php
namespace App\Utils;
class DateTimeUtils
{
/**
* 今天7点到明天7点算作今天
*/
public static function getToday()
{
$time = time();
$inventoryTime = strtotime(date('Y-m-d 07:00:00'));
if ($time < $inventoryTime) {
$time = strtotime('-1 day');
}
return date('Y-m-d', $time);
}
public static function getMicroTime($dateTime = null)
{
$time = microtime(true);
if ($dateTime && is_string($dateTime)) {
$time = strtotime($dateTime);
}
if ($dateTime && is_int($dateTime)) {
$time = $dateTime;
}
$time *= 1000;
return ceil($time);
}
}