public function format(string $format = null, int $numbers = null)
    {
        $numbers = $numbers === null ? static::getDefaultNumbers() : $numbers;
        $format = $format === null ? static::getToStringFormat() : $format;

        $formatArray = str_split($format);
        $dateString = '';

        foreach ($formatArray as $key => $value)
        {
            if (key_exists($value, $this->values))
            {
                $dateString .= $this->values[$value];
                continue;
            }

            $dateString .= $value;
        }

        if ($numbers === static::INDIAN_NUMBERS)
        {
            $dateString = str_replace($this->arabicNumbers, $this->indianNumbers, $dateString);
        }

        return $dateString;
    }
public function format(string $format = null, int $numbers = null)
    {
        $numbers = $numbers === null ? static::getDefaultNumbers() : $numbers;
        $format = $format === null ? static::getToStringFormat() : $format;

        $formatArray = str_split($format);
        $dateString = '';

        foreach ($formatArray as $key => $value)
        {
            if (key_exists($value, $this->values))
            {
                $dateString .= $this->values[$value];
                continue;
            }

            $dateString .= $value;
        }

        if ($numbers === static::INDIAN_NUMBERS)
        {
            $dateString = str_replace($this->arabicNumbers, $this->indianNumbers, $dateString);
        }

        return $dateString;
    }
public function format ( string $ format = null , int $ numbers = null ) { $ numbers = $ numbers === null ? static :: getDefaultNumbers ( ) : $ numbers ; $ format = $ format === null ? static :: getToStringFormat ( ) : $ format ; $ formatArray = str_split ( $ format ) ; $ dateString = '' ; foreach ( $ formatArray as $ key => $ value ) { if ( key_exists ( $ value , $ this -> values ) ) { $ dateString .= $ this -> values [ $ value ] ; continue ; } $ dateString .= $ value ; } if ( $ numbers === static :: INDIAN_NUMBERS ) { $ dateString = str_replace ( $ this -> arabicNumbers , $ this -> indianNumbers , $ dateString ) ; } return $ dateString ; }
get date string

@param string $format
@param int    $numbers

@return string
get date string