PHP

PHP Menu

PHP

date_time_set() Function - Definition, Syntax, Parameters, Examples

Definition

The date_time_set() function sets the time.

Syntax

date_time_set(object, hour, minute, second, microseconds)

Parameters

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.

Example

<?php
$date = date_create("2021-12-25"); date_time_set($date, 13, 24); echo date_format($date, "Y-m-d H:i:s");

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods