// MySQL 에서 현재시간 가져옴
$sql_query = "select now()";
$res = $db->query($sql_query);
$data = $db->fetch_array($res);
// $now = time();
$YY = (int)substr($data[0], 0, 4);
$MM = (int)substr($data[0], 5, 2);
$DD = (int)substr($data[0], 8, 2);
$HH = (int)substr($data[0], 11, 2);
$MI = (int)substr($data[0], 14, 2);
$tm_unix_now = mktime($HH,$MI,0,$MM,$DD,$YY);
$tm_unix_pre = $tm_unix_now - 5*60; // 5분전 시간
$tm_now = date('YmdHi', $tm_unix_now);
$tm_pre = date('YmdHi', $tm_unix_pre);
echo "tm_now : $tm_now <br>";
echo "tm_pre : $tm_pre <br>";
'HTML' 카테고리의 다른 글
★ php ★ [php 입문][유용] 변수, 상수 및 데이터형 (0) | 2011.05.11 |
---|---|
★ php substr ★ asp right() 힘수 php로 만들기 (0) | 2011.05.10 |
★ php substr ★ [php함수] strpos(),strrpos(),strrchr(),strstr(),substr() (0) | 2011.05.10 |
★ php substr ★ PHP 함수 substr() 사용법 (0) | 2011.05.10 |
★ php substr ★ [php] javascript unescape (0) | 2011.05.10 |