php 몇분전, 몇시간전, 몇일전 함수
[code]
function format_date($time){
$t=time()-$time;
$f=array(
'31536000'=>'년',
'2592000'=>'개월',
'604800'=>'주',
'86400'=>'일',
'3600'=>'시간',
'60'=>'분',
'1'=>'초'
);
foreach ($f as $k=>$v) {
if (0 !=$c=floor($t/(int)$k)) {
return $c.$v.'전';
}
}
}
[/code]
댓글 6개
2년 전
나 필요하던건데,
민트다이어리
2년 전
감사합니다. ^^
2년 전
감사 합니다.
2년 전
[code]
<?php
// 현재 시간과 10분 전 시간 계산
$current_time = time();
$ten_minutes_ago = $current_time - (10 * 60);
// 현재 시간과 10분 전 시간을 비교하여 안내 창을 띄움
if (time() >= $ten_minutes_ago) {
echo "<script>alert('10분 전에 중요한 공지사항이 있습니다!');</script>";
}
?>
[/code]
<?php
// 현재 시간과 10분 전 시간 계산
$current_time = time();
$ten_minutes_ago = $current_time - (10 * 60);
// 현재 시간과 10분 전 시간을 비교하여 안내 창을 띄움
if (time() >= $ten_minutes_ago) {
echo "<script>alert('10분 전에 중요한 공지사항이 있습니다!');</script>";
}
?>
[/code]
marty72
2년 전
공유 감사드립니다 ^^
2년 전
감사합니다.
게시글 목록
| 번호 | 제목 |
|---|---|
| 15969 |
jQuery
.jquery
|
| 15968 |
JavaScript
공휴일을 제외한 시간적용 ON/OFF 스크립트예제 (휴일추가가능)
|
| 15967 |
jQuery
.is()
|
| 15966 |
jQuery
.insertBefore()
|
| 15965 |
jQuery
.insertAfter()
|
| 15964 |
jQuery
.innerWidth ()
|
| 15963 |
jQuery
.innerHeight ()
|
| 15962 |
jQuery
.index()
|
| 15961 |
jQuery
jQuery( ":image" )
|
| 15960 |
jQuery
jQuery ( "# id")
|
| 15959 |
jQuery
.html()
|
| 15958 | |
| 15957 |
jQuery
.hide ()
|
| 15956 |
jQuery
jQuery ( ": hidden")
|
| 15955 |
기타
그누보드5 기본쿼리
|
| 15954 |
jQuery
.height()
|
| 15953 |
jQuery
jQuery ( ": header")
|
| 15952 |
jQuery
.hasClass( className )
|
| 15949 |
PHP
네이버 클로버 tts
3
|
| 15947 |
node.js
네이트온 팀룸으로 메일 수신 확인
1
|
| 15946 |
jQuery
jQuery ( ": has (selector)")
|
| 15945 |
jQuery
attributeHas 선택자
|
| 15944 |
jQuery
.has (selector)
|
| 15942 |
jQuery
.get (index)
|
| 15941 |
jQuery
.focusin (handler)
|
| 15940 |
jQuery
.focusin (handler)
|
| 15939 |
jQuery
jQuery ( ": focus")
|
| 15938 |
jQuery
.focus (handler)
|
| 15937 |
jQuery
jQuery( ":first" )
|
| 15936 |
jQuery
jQuery ( ": first-of-type")
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기