PapuuWiki
PHP/Æü»þ
¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤·¤ÆºîÀ®
³«»Ï¹Ô:
[[PHP]]
*¥¿¥¤¥à¥¾¡¼¥óÀßÄê
date_default_timezone_set('Asia/Tokyo');
*¥¿¥¤¥à¥¹¥¿¥ó¥× [#e5cf3195]
¥µ¡¼¥Ð¾å¤Ç¤Î¡¢1970ǯ1·î1Æü00»þ00ʬ00Éà GMT ¤«¤é¤Î·Ð²áÉÿô~
[[time>http://jp2.php.net/manual/ja/function.time.php]]
// ¸½ºß¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = time();
[[mktime>http://jp2.php.net/manual/ja/function.mktime.php]]
// »ØÄêÆü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = mktime([int »þ[, int ʬ[, int ÉÃ[, int ·î[...
[[gmmktime>http://jp2.php.net/manual/ja/function.gmmktime...
// GMT»ØÄêÆü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = gmmktime([int »þ[, int ʬ[, int ÉÃ[, int ...
[[strtotime>http://jp2.php.net/manual/ja/function.strtoti...
// »ØÄêʸ»úÎó¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = strtotime('2006-09-04 18:34:11')
[[filemtime>http://jp2.php.net/manual/ja/function.filemti...
// ¥Õ¥¡¥¤¥ëºÇ½ª¹¹¿·Æü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = filemtime('index.html')
*[[getdate>http://jp2.php.net/manual/ja/function.getdate....
/**
* Æü»þʸ»úÎó¼èÆÀ
* @param $iTimeStamp ¥¿¥¤¥à¥¹¥¿¥ó¥×
* @return ¼¡¤Î¤è¤¦¤Êʸ»úÎó¤òÊÖ¤·¤Þ¤¹¡£2008ǯ2·î10Æü...
*/
function getDateString($iTimeStamp)
{
$arStrDayOfTheWeek = array("Æü", "·î", "²Ð", "¿å...
$arDateInfo = getdate($iTimeStamp);
$strDayOfTherWeek = $arStrDayOfTheWeek[$arDateIn...
$strReturn = $arDateInfo['year']."ǯ".$arDateInf...
if ($arDateInfo['hours'] >= 12) {
$strReturn .= "¸á¸å";
} else {
$strReturn .= "¸áÁ°";
}
$strReturn .= ($arDateInfo['hours'] % 12)."»þ".$...
return $strReturn;
}
print getDateString(time())."<br>\n";
*[[date>http://jp2.php.net/manual/ja/function.date.php]]...
$strDate = date(¥Õ¥©¡¼¥Þ¥Ã¥Èʸ»úÎó[, ¥¿¥¤¥à¥¹¥¿¥ó¥×]);
// ¸½ºß¤ÎÆü»þ¤òɽ¼¨
// 2006-09-14 (Thu) 12:20:45
print date("Y-m-d (D) H:i:s", time())
|¥Õ¥©¡¼¥Þ¥Ã¥È|ÆâÍÆ|Îã|h
|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>http://jp2.php.net/manual/ja/function.checkd...
checkdate(·î, Æü, ǯ)¤Ç¡¢Â¸ºß¤¹¤ëÆüÉդΤȤTRUE¤¬ÊÖ¤ê¤Þ...
for ($i = 1; checkdate(2, $i, 2008); $i++) {
print("$i ");
}
*¥ê¥ó¥¯
-[[PHP ¤Ë¤è¤ëÆüÉÕ¡¦»þ¹ï¡¦»þ´Ö¤Î·×»»¡¦±é»»¤Î¤Þ¤È¤á>http://...
-[[JavaScript ¤Ë¤è¤ëÆüÉÕ¡¦»þ¹ï¡¦»þ´Ö¤Î·×»»¡¦±é»»¤Î¤Þ¤È¤á>...
½ªÎ»¹Ô:
[[PHP]]
*¥¿¥¤¥à¥¾¡¼¥óÀßÄê
date_default_timezone_set('Asia/Tokyo');
*¥¿¥¤¥à¥¹¥¿¥ó¥× [#e5cf3195]
¥µ¡¼¥Ð¾å¤Ç¤Î¡¢1970ǯ1·î1Æü00»þ00ʬ00Éà GMT ¤«¤é¤Î·Ð²áÉÿô~
[[time>http://jp2.php.net/manual/ja/function.time.php]]
// ¸½ºß¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = time();
[[mktime>http://jp2.php.net/manual/ja/function.mktime.php]]
// »ØÄêÆü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = mktime([int »þ[, int ʬ[, int ÉÃ[, int ·î[...
[[gmmktime>http://jp2.php.net/manual/ja/function.gmmktime...
// GMT»ØÄêÆü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = gmmktime([int »þ[, int ʬ[, int ÉÃ[, int ...
[[strtotime>http://jp2.php.net/manual/ja/function.strtoti...
// »ØÄêʸ»úÎó¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = strtotime('2006-09-04 18:34:11')
[[filemtime>http://jp2.php.net/manual/ja/function.filemti...
// ¥Õ¥¡¥¤¥ëºÇ½ª¹¹¿·Æü»þ¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò¼èÆÀ
$iTimeStamp = filemtime('index.html')
*[[getdate>http://jp2.php.net/manual/ja/function.getdate....
/**
* Æü»þʸ»úÎó¼èÆÀ
* @param $iTimeStamp ¥¿¥¤¥à¥¹¥¿¥ó¥×
* @return ¼¡¤Î¤è¤¦¤Êʸ»úÎó¤òÊÖ¤·¤Þ¤¹¡£2008ǯ2·î10Æü...
*/
function getDateString($iTimeStamp)
{
$arStrDayOfTheWeek = array("Æü", "·î", "²Ð", "¿å...
$arDateInfo = getdate($iTimeStamp);
$strDayOfTherWeek = $arStrDayOfTheWeek[$arDateIn...
$strReturn = $arDateInfo['year']."ǯ".$arDateInf...
if ($arDateInfo['hours'] >= 12) {
$strReturn .= "¸á¸å";
} else {
$strReturn .= "¸áÁ°";
}
$strReturn .= ($arDateInfo['hours'] % 12)."»þ".$...
return $strReturn;
}
print getDateString(time())."<br>\n";
*[[date>http://jp2.php.net/manual/ja/function.date.php]]...
$strDate = date(¥Õ¥©¡¼¥Þ¥Ã¥Èʸ»úÎó[, ¥¿¥¤¥à¥¹¥¿¥ó¥×]);
// ¸½ºß¤ÎÆü»þ¤òɽ¼¨
// 2006-09-14 (Thu) 12:20:45
print date("Y-m-d (D) H:i:s", time())
|¥Õ¥©¡¼¥Þ¥Ã¥È|ÆâÍÆ|Îã|h
|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>http://jp2.php.net/manual/ja/function.checkd...
checkdate(·î, Æü, ǯ)¤Ç¡¢Â¸ºß¤¹¤ëÆüÉդΤȤTRUE¤¬ÊÖ¤ê¤Þ...
for ($i = 1; checkdate(2, $i, 2008); $i++) {
print("$i ");
}
*¥ê¥ó¥¯
-[[PHP ¤Ë¤è¤ëÆüÉÕ¡¦»þ¹ï¡¦»þ´Ö¤Î·×»»¡¦±é»»¤Î¤Þ¤È¤á>http://...
-[[JavaScript ¤Ë¤è¤ëÆüÉÕ¡¦»þ¹ï¡¦»þ´Ö¤Î·×»»¡¦±é»»¤Î¤Þ¤È¤á>...
¥Ú¡¼¥¸Ì¾: