Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- MySQL
- file-upload
- Session
- function
- 웹하드순위
- Regex
- Ajax
- Arrays
- variables
- UTF-8
- JavaScript
- 무료다운로드쿠폰
- JSON
- Linux
- jquery
- Forms
- Laravel
- string
- php
- HTML
- 전략
- Apache
- date
- 웹하드추천
- 경영
- curl
- composer-php
- post
- OOP
Archives
- Today
- Total
개발! 딱 깔끔하고 센스있게!
PHP 는 날짜와 시간을 비교해서 [중복] 본문
This question already has an answer here:
- comparing date and time php 2 answers
나는 세 번 데이트한 A, B 와 C 가 있다.
A = 2013-08-10 10:00 B = 2013-08-10 12:00 C = 2013-08-10 10:22
C 가 A 와 B 에서 되돌아올지 여부를 확인하는 것이다.
어떻게 하는지 아시는 분?
저는 운이 없어서 해봤어요.
if ($time >= $date_start && $time <= $date_end) { echo "is between\n"; } else { echo 'no'; }
대답
UNIX 시간 스탬프를 비교할 수 있습니다.
$A = strtotime($A); //gives value in Unix Timestamp (seconds since 1970) $B = strtotime($B); $C = strtotime($C); if ((($C < $A) && ($C > $B)) || (($C > $A) && ($C < $B)) ){ echo "Yes '$C' is between '$A' and '$B'"; }
'개발 스크랩 메모 > PHP' 카테고리의 다른 글
PHP 12444 public state state state 함수를 왜 사용합니까?[폐쇄!] (0) | 2020.12.25 |
---|---|
PHP-동적 생성 (과 응답) 의 HTML 문자열을 읽습니까? (0) | 2020.12.25 |
PHP 분해 문자열을 사용할 때 모든 빈 값을 삭제합니까? (0) | 2020.12.25 |
php url 분해 (0) | 2020.12.24 |
어떻게 PHP 에 txt 파일을 올리고 다른 페이지에서 읽을 수 있습니까? (0) | 2020.12.24 |
Comments