Top

[PHP] ³¯Â¥ Æ÷¸Ë º¯°æ ÇÔ¼ö ver.2 | Web-Programing
±è°æÈÆ (admin) | Editor | 2012/11/27 13:37:49 | Á¶È¸:5364

  1.  function format_time ($time, $format)
  2. {
  3. $time = preg_replace("/[^0-9]/", "", $time);
  4.  
  5. if (strlen($time) >= 8)
  6. {
  7. $regday1 = trim(substr($time,0,4)); // ³â
  8. $regday2 = trim(substr($time,4,2)); // ¿ù
  9. $regday3 = trim(substr($time,6,2)); // ÀÏ
  10. $regday4 = trim(substr($time,8,2)); // ½Ã
  11. $regday5 = trim(substr($time,10,2)); // ºÐ
  12. $regday6 = trim(substr($time,12,2)); // ÃÊ
  13. }
  14. if($format)
  15. {
  16. $format = str_replace("YYYY",$regday1,$format); // ³â
  17. $format = str_replace("MM",$regday2,$format);   // ¿ù
  18. $format = str_replace("DD",$regday3,$format);   // ÀÏ
  19. $format = str_replace("HH",$regday4,$format);   // ½Ã
  20. $format = str_replace("mm",$regday5,$format);   // ºÐ
  21. $format = str_replace("SS",$regday6,$format);   // ÃÊ
  22. $pday = $format;
  23. }
  24. if($time) return $pday;
  25. else return;
  26. }
³¯Â¥ Æ÷¸Ë º¯°æ ÇÔ¼ö

ÇÔ¼ö¸í : format_time()
¼³¸í : 
- Æ÷¸Ë Çü½Ä Y : ³â, M : ¿ù, D : ÀÏ, S : ½Ã, m : ºÐ, ÃÊ : S
- format_time( $½Ã°£°ª, "Æ÷¸Ë Çü½Ä");

»ç¿ë¹æ¹ý : 
»ç¿ë¿¹ -> format_time( $INSERT_TIME, "YYYY.MM.DD SS:mm");
°á°ú°ª -> 2012.11.21 04:23

ºñ°í : 
¿¹Àü¿¡ ¿Ã·È´ø ¹öÀü 1°úÀÇ Â÷ÀÌÁ¡Àº..
º¸³»´Â µ¥ÀÌÅÍÀÇ ³¯Â¥ Çü½ÄÀÌ º¸´Ù ÀÚÀ¯·Î¿ö Á³´Ù!
°øÀ¯Çϱâ
°øÀ¯Çϱâ
1
0
0


´ñ±ÛÀ» ºÒ·¯¿À´Â ÁßÀÔ´Ï´Ù.
¡ã ÀÌÀü±Û [ckeditor] À̹ÌÁö ¾÷·Îµå ! ½ÅÀå¹Ì (shinjm) 2012-11-28 09:03:07
¡å ´ÙÀ½±Û [PHP] ³¯Â¥ Æ÷¸Ë º¯°æ ÇÔ¼ö ±è°æÈÆ (admin) 2012-11-22 16:39:59