[Function] strtotime
페이지 정보
작성자 MintState 댓글 0건 조회 13,969회 작성일 08-11-03 11:17본문
[Function] strtotime
strtotime
(PHP 3>= 3.0.12, PHP 4 , PHP 5)
strtotime -- Parse about any English textual datetime description into a Unix timestamp
설명
int strtotime ( string time [, int now])
The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp relative to the timestamp given in now, or the current time if none is supplied. Upon failure, -1 is returned.
Because strtotime() behaves according to GNU date syntax, have a look at the GNU manual page titled Date Input Formats. Described there is valid syntax for the time parameter.
예 1.
예 2. - sql의 필드가 datetime 일때 유용 합니다.
strtotime
(PHP 3>= 3.0.12, PHP 4 , PHP 5)
strtotime -- Parse about any English textual datetime description into a Unix timestamp
설명
int strtotime ( string time [, int now])
The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp relative to the timestamp given in now, or the current time if none is supplied. Upon failure, -1 is returned.
Because strtotime() behaves according to GNU date syntax, have a look at the GNU manual page titled Date Input Formats. Described there is valid syntax for the time parameter.
예 1.
<?php echo strtotime("now"), "\n"; echo strtotime("10 September 2000"), "\n"; echo strtotime("+1 day"), "\n"; echo strtotime("+1 week"), "\n"; echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n"; echo strtotime("next Thursday"), "\n"; echo strtotime("last Monday"), "\n"; ?>
예 2. - sql의 필드가 datetime 일때 유용 합니다.
<? $key_time = '2006-10-24 18:30:53'; echo $key_time."<br />"; $strtime = strtotime($key_time); echo $strtime."<br />"; $r_time = date("r",$strtime); echo $r_time."<br />"; $datetime = date('Y-m-d h:i:s', $strtime); echo $datetime."<br />"; echo date("Y-m-d h:i:s", mktime(18, 30, 53, 10, 24, 2006)); ?>
|
댓글목록
등록된 댓글이 없습니다.