jDateTime::getdate PHP Méthode

getdate() public static méthode

Like php built-in function, returns an associative array containing the date information of a timestamp, or the current local time if no timestamp is given. .
Author: Meysam Pour Ganji
public static getdate ( $timestamp = null ) : An
$timestamp int The timestamp that whould convert to date information array, if NULL passed, current timestamp will be processed.
Résultat An associative array of information related to the timestamp. For see elements of the returned associative array see {@link http://php.net/manual/en/function.getdate.php#refsect1-function.getdate-returnvalues}.
    public static function getdate($timestamp = null)
    {
        if ($timestamp === null) {
            $timestamp = time();
        }
        if (is_string($timestamp)) {
            if (ctype_digit($timestamp) || $timestamp[0] == '-' && ctype_digit(substr($timestamp, 1))) {
                $timestamp = (int) $timestamp;
            } else {
                $timestamp = strtotime($timestamp);
            }
        }
        $dateString = self::date("s|i|G|j|w|n|Y|z|l|F", $timestamp);
        $dateArray = explode("|", $dateString);
        $result = array("seconds" => $dateArray[0], "minutes" => $dateArray[1], "hours" => $dateArray[2], "mday" => $dateArray[3], "wday" => $dateArray[4], "mon" => $dateArray[5], "year" => $dateArray[6], "yday" => $dateArray[7], "weekday" => $dateArray[8], "month" => $dateArray[9], 0 => $timestamp);
        return $result;
    }