PHP date_time_set() function

PHP date_sunset() function
PHP date_timestamp_get() function

In this article, you will learn how to set the date and time function. The date_time_set() function sets the time according to the specified details. But, yes, that will take some time to absorb the things.

What is the syntax of the date_time_set() function in PHP?

date_time_set(object, hour, minute, second, microseconds)
ParameterDescription
objectRequired. Specifies a DateTime object returned by date_create()
hourRequired. Specifies the hour of the time
minuteRequired. Specifies the minute of the time
secondOptional. Specifies the second of the time. Default is 0
microsecondsOptional. Specifies the microsecond of the time. Default is 0
PHP date_time_set() method

Examples of the date_time_set() function

Example 1.

<?php
$d=date_create("2014-06-02");
date_time_set($d,11,30);
echo date_format($d,"Y-m-d H:i:s");
?>
PHP date_sunset() function
PHP date_timestamp_get() function
en English
X
Scroll to Top