PHP date_date_set() 함수
예시
새 DateTime 객체를 반환하고 새 날짜를 설정한 다음 날짜 형식을 지정합니다.
<?php
$date=date_create();
date_date_set($date,2020,10,30);
echo date_format($date,"Y/m/d");
?>
정의 및 사용
date_date_set() 함수는 새 날짜를 설정합니다.
통사론
date_date_set(object, year, month, day)
매개변수 값
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
year | Required. Specifies the year of the date |
month | Required. Specifies the month of the date |
day | Required. Specifies the day of the date |
기술적 세부 사항
반환 값: | 성공하면 새 DateTime 객체를 반환합니다. 실패시 FALSE |
---|---|
PHP 버전: | 5.2+ |
PHP 변경 로그: | PHP 5.3: 반환 값이 NULL에서 DateTime으로 변경됨(성공 시) |
❮ PHP 날짜/시간 참조