PHP date_time_set() 함수
예시
시간 설정:
<?php
$date=date_create("2013-05-01");
date_time_set($date,13,24);
echo date_format($date,"Y-m-d H:i:s");
?>
정의 및 사용
date_time_set() 함수는 시간을 설정합니다.
통사론
date_time_set(object, hour, minute, second, microseconds)
매개변수 값
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
hour | Required. Specifies the hour of the time |
minute | Required. Specifies the minute of the time |
second | Optional. Specifies the second of the time. Default is 0 |
microseconds | Optional. Specifies the microsecond of the time. Default is 0 |
기술적 세부 사항
반환 값: | 성공하면 DateTime 객체를 반환합니다. 실패시 FALSE |
---|---|
PHP 버전: | 5.2+ |
PHP 변경 로그: | PHP 7.1: 마이크로초 매개변수 추가 PHP 5.3: 반환 값을 NULL에서 DateTime으로 변경 |
❮ PHP 날짜/시간 참조