ȥå   Խ ʬ Хåå ź ʣ ̾ѹ   ñ측 ǽ   إ   ǽRSS

PHP/

Last-modified: 2011-11-25 () 14:51:08 (2127d)
Top / PHP /

PHP

date_default_timezone_set('Asia/Tokyo');

оǤΡ1970ǯ110000ʬ00 GMT ηвÿ

time

// ߤΥॹפ
$iTimeStamp = time();

mktime

// Υॹפ
$iTimeStamp = mktime([int [, int ʬ[, int [, int [, int [, ǯ]]]]]]);

gmmktime

// GMTΥॹפ
$iTimeStamp = gmmktime([int [, int ʬ[, int [, int [, int [, ǯ]]]]]]);

strtotime

// ʸΥॹפ
$iTimeStamp = strtotime('2006-09-04 18:34:11')

filemtime

// եǽΥॹפ
$iTimeStamp = filemtime('index.html')

getdateˤμ

    /**
     * ʸ
     * @param $iTimeStamp ॹ
     * @return Τ褦ʸ֤ޤ2008ǯ210() 721ʬ26
     */
    function getDateString($iTimeStamp)
    {
        $arStrDayOfTheWeek = array("", "", "", "", "", "", "");
        $arDateInfo = getdate($iTimeStamp);
        $strDayOfTherWeek = $arStrDayOfTheWeek[$arDateInfo['wday']];
        $strReturn = $arDateInfo['year']."ǯ".$arDateInfo['mon']."".$arDateInfo['mday']."(".$strDayOfTherWeek.") ";
        if ($arDateInfo['hours'] >= 12) {
            $strReturn .= "";
        } else {
            $strReturn .= "";
        }
        $strReturn .= ($arDateInfo['hours'] % 12)."".$arDateInfo['minutes']."ʬ".$arDateInfo['seconds']."";
        return $strReturn;
    }
    print getDateString(time())."<br>\n";

dateˤʸΥեޥå

$strDate = date(եޥåʸ[, ॹ]);
// ߤɽ
// 2006-09-14 (Thu) 12:20:45
print date("Y-m-d (D) H:i:s", time())
եޥå
Yǯ2011
yǯ11
m0եɽ0112
nɽ112
FѸɽJanuary, ...
MʸɽJan, ...
jɽ131
d0եɽ0131
wɽ0:, 1:, ...
lѸɽSunday, Monday, ...
DʸɽSun, Mon, ...
AAMޤPMAM, PM
g֡12ɽ112
G֡24ɽ124
h֡12֣եɽ0112
H֡24֣եɽ0124
iʬ0059
s0059
uޥ(PHP 5.2.2)0999

checkdateˤեå

checkdate(, , ǯ)ǡ¸ߤդΤȤTRUE֤ޤ
for ($i = 1; checkdate(2, $i, 2008); $i++) {
    print("$i ");
}