PHP/Æü»þ
Last-modified: 2018-11-14 (¿å) 15:23:57 (2153d)
¥¿¥¤¥à¥¾¡¼¥óÀßÄê
date_default_timezone_set('Asia/Tokyo');
¥¿¥¤¥à¥¹¥¿¥ó¥× †
¥µ¡¼¥Ð¾å¤Ç¤Î¡¢1970ǯ1·î1Æü00»þ00ʬ00Éà GMT ¤«¤é¤Î·Ð²áÉÿô
// ¸½ºß¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ $iTimeStamp = time();
// »ØÄêÆü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ $iTimeStamp = mktime([int »þ[, int ʬ[, int ÉÃ[, int ·î[, int Æü[, ǯ]]]]]]);
// GMT»ØÄêÆü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ $iTimeStamp = gmmktime([int »þ[, int ʬ[, int ÉÃ[, int ·î[, int Æü[, ǯ]]]]]]);
// »ØÄêʸ»úÎó¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ $iTimeStamp = strtotime('2006-09-04 18:34:11')
// ¥Õ¥¡¥¤¥ëºÇ½ª¹¹¿·Æü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ $iTimeStamp = filemtime('index.html')
getdate¤Ë¤è¤ëÆü»þ¾ðÊó¤Î¼èÆÀ †
/** * Æü»þʸ»úÎó¼èÆÀ * @param $iTimeStamp ¥¿¥¤¥à¥¹¥¿¥ó¥× * @return ¼¡¤Î¤è¤¦¤Êʸ»úÎó¤òÊÖ¤·¤Þ¤¹¡£2008ǯ2·î10Æü(Æü) ¸á¸å7»þ21ʬ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¥Õ¥£¥ëɽµ | 01¡Á12 |
n | ·î¡§¿ô»úɽµ | 1¡Á12 |
F | ·î¡§±Ñ¸ìɽµ | January, ... |
M | ·î¡§£³Ê¸»úɽµ | Jan, ... |
j | Æü¡§¿ô»úɽµ | 1¡Á31 |
d | Æü¡§0¥Õ¥£¥ëɽµ | 01¡Á31 |
w | ÍËÆü¡§¿ô»úɽµ | 0:ÆüÍËÆü, 1:·îÍËÆü, ... |
l | ÍËÆü¡§±Ñ¸ìɽµ | Sunday, Monday, ... |
D | ÍËÆü¡§£³Ê¸»úɽµ | Sun, Mon, ... |
A | AM¤Þ¤¿¤ÏPM | AM, PM |
g | »þ´Ö¡§12»þ´Öɽµ | 1¡Á12 |
G | »þ´Ö¡§24»þ´Öɽµ | 1¡Á24 |
h | »þ´Ö¡§12»þ´Ö£°¥Õ¥£¥ëɽµ | 01¡Á12 |
H | »þ´Ö¡§24»þ´Ö£°¥Õ¥£¥ëɽµ | 01¡Á24 |
i | ʬ | 00¡Á59 |
s | ÉÃ | 00¡Á59 |
u | ¥Þ¥¤¥¯¥íÉÃ(PHP 5.2.2¤«¤é) | 0¡Á999 |
checkdate¤Ë¤è¤ëÆüÉÕ¥Á¥§¥Ã¥¯ †
checkdate(·î, Æü, ǯ)¤Ç¡¢Â¸ºß¤¹¤ëÆüÉդΤȤTRUE¤¬ÊÖ¤ê¤Þ¤¹¡£
for ($i = 1; checkdate(2, $i, 2008); $i++) { print("$i "); }