Skip to content

Instantly share code, notes, and snippets.

@zguillez
Created June 27, 2023 09:35
Show Gist options
  • Save zguillez/670b3697a5f36d5fae64bfe025136e75 to your computer and use it in GitHub Desktop.
Save zguillez/670b3697a5f36d5fae64bfe025136e75 to your computer and use it in GitHub Desktop.
Time Helpers in PHP
function getNow()
{
return date('Y-m-d H:i:s');
}
function getNowISO()
{
return date('c', time());
}
function getToday($full = false)
{
return $full ? date('Y-m-d 00:00:00') : date('Y-m-d');
}
function isWeekend(): bool
{
return date('N', strtotime($this->getNow())) >= 6;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment