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 |
Tags
- 웹하드추천
- UTF-8
- file-upload
- Forms
- Arrays
- JavaScript
- JSON
- 전략
- 웹하드순위
- Apache
- Session
- jquery
- HTML
- 무료다운로드쿠폰
- OOP
- variables
- post
- string
- date
- Linux
- Ajax
- curl
- composer-php
- Regex
- php
- 경영
- Laravel
- function
- MySQL
Archives
- Today
- Total
개발! 딱 깔끔하고 센스있게!
php 에서 DateInterval 대상 을 초 로 변환 합 니 다. 본문
php 에서 이 $interval 을 어떻게 seconds 로 바 꿉 니까?
대답 하 다.
여기 에는 함수 형식 이 하나 있다.
단 초 를 되 돌려 주지 않 습 니 다.
이 기술 을 사용 하 는 초 수 를 획득 합 니 다.
$seconds = abs($datetime1->getTimestamp()-$datetime2->getTimestamp());
만약 당신 이 정말 $interval 을 사용 하고 싶다 면, 그것 을 계산 해 야 합 니 다.
$seconds = $interval->days*86400 + $interval->h*3600 + $interval->i*60 + $interval->s;
여기 있 습 니 다.
-
86400
is the number of seconds in a day -
3600
is the number of seconds in an hour -
60
is the number of seconds in a minute
'개발 스크랩 메모 > PHP' 카테고리의 다른 글
PHP, Codeigniter: 웹 프로그램 에서 사용자 시간 대 / 위치 기반 전역 설정 날짜 / 시간 을 설정 하 는 방법 은? (0) | 2020.12.09 |
---|---|
PHP 에서 Array Iterator, Array Object 와 Array 의 차이 점 (0) | 2020.12.09 |
비밀번호 확인 키 PHP 검증 (0) | 2020.12.08 |
Google Maps API 와 PHP 는 두 위치 사이 의 거 리 를 함께 찾 습 니 다. (0) | 2020.12.08 |
PHP Regex - 태그 사이 의 텍스트 삭제 (0) | 2020.12.08 |
Comments