Tools.php
public static function dow($date = null)
    {
        if ($date === null) {
            $date = new DateTime();
        } elseif (!$date instanceof DateTime) {
            if (\is_int($date)) {
                $date = new DateTime('@' . $date);
            } elseif (\is_string($date)) {
                $date = new DateTime($date);
            } else {
                throw new RuntimeException(self::poorManTranslate('fts-shared', 'Invalid date format'));
            }
        }

        return (int)$date->format('N') - 1;
    }
public static function dow($date = null)
    {
        if ($date === null) {
            $date = new DateTime();
        } elseif (!$date instanceof DateTime) {
            if (\is_int($date)) {
                $date = new DateTime('@' . $date);
            } elseif (\is_string($date)) {
                $date = new DateTime($date);
            } else {
                throw new RuntimeException(self::poorManTranslate('fts-shared', 'Invalid date format'));
            }
        }

        return (int)$date->format('N') - 1;
    }
public static function dow ( $ date = null ) { if ( $ date === null ) { $ date = new DateTime ( ) ; } elseif ( ! $ date instanceof DateTime ) { if ( \ is_int ( $ date ) ) { $ date = new DateTime ( '@' . $ date ) ; } elseif ( \ is_string ( $ date ) ) { $ date = new DateTime ( $ date ) ; } else { throw new RuntimeException ( self :: poorManTranslate ( 'fts-shared' , 'Invalid date format' ) ) ; } } return ( int ) $ date -> format ( 'N' ) - 1 ; }
Get day of week
Function is compatible with SQL function WEEKDAY()

@param DateTime|int|string|null $date Datetime object, timestamp, date in valid format or null for current date
@return int Day index (0 = Monday, 6 = Sunday)
@throws RuntimeException
Get day of week Function is compatible with SQL function WEEKDAY ()