Skip to content

Commit

Permalink
Added now() and today() helper functions (#6579)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia authored Mar 13, 2024
1 parent f59b668 commit cd5d284
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
*/
namespace Hyperf\Support;

use Carbon\Carbon;
use Closure;
use DateTimeZone;
use Hyperf\Collection\Arr;
use Hyperf\Context\ApplicationContext;
use Hyperf\Stringable\StrCache;
Expand Down Expand Up @@ -264,3 +266,25 @@ function msleep(int $milliSeconds): void
{
usleep($milliSeconds * 1000);
}

/**
* Create a new Carbon instance for the current time.
*
* @param null|DateTimeZone|string $tz
* @return Carbon
*/
function now($tz = null)
{
return Carbon::now($tz);
}

/**
* Create a new Carbon instance for the current date.
*
* @param null|DateTimeZone|string $tz
* @return Carbon
*/
function today($tz = null)
{
return Carbon::today($tz);
}

0 comments on commit cd5d284

Please sign in to comment.