| 풍선도움말... |
ㆍ돈 걱정을 하지않아도 되는 편안한 삶을 상상해 보세요.
![]()
|
컴퓨터와 관련있는 모든 팁을 공유합시다.
php로 날짜 및 시간 계산을 하는 예제
$timestamp = strtotime("Now"); echo "현재 일시 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+1 seconds"); echo "현재로부터 1초 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("-1 seconds"); echo "현재로부터 1초 앞 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+1 minutes"); echo "현재로부터 1분 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+1 hours"); echo "현재로부터 1시간 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+1 days"); echo "현재로부터 1일 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+1 week"); echo "현재로부터 1주 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+1 months"); echo "현재로부터 1달 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+1 years"); echo "현재로부터 1년 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+4 years +3 months +2 days +1 hours"); echo "현재로부터 4년 3개월 2일 1시간 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("2001-01-01"); echo "2001년 1월 1일 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("2001-01-01 +1 months"); echo "2001년 1월 1일을 기준으로 1달 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("2001/01/01 +2 months"); echo "2001년 1월 1일을 기준으로 2달 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("20010101 +3 months"); echo "2001년 1월 1일을 기준으로 3달 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("2001/01/01 000000 +4 months"); echo "2001년 1월 1일을 기준으로 4달 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+5 months", strtotime("2001/01/01 000000")); echo "2001년 1월 1일을 기준으로 5달 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; $timestamp = strtotime("+6 months", strtotime("2001-01-01 00:00:00")); echo "2001년 1월 1일을 기준으로 6달 뒤 : ".date("Y-m-d H:i:s", $timestamp)." "; TAG : php날짜 php시간 date날짜 date시간 |
||||||||||||||||||||||||||||||||||
![]() |
부산광역시 부산진구 당감 4동 659-1. 좋은 소프트웨어 개발 운동본부. 대표 안득호 / sinmungo @ hotmail . com Copyright(c) 호가계부. All Rights Reserved. Since 2003. 04 |