Hướng dẫn new datetime php
The DateTime class(PHP 5 >= 5.2.0, PHP 7, PHP 8) Show IntroductionRepresentation of date and time. This class behaves the same as DateTimeImmutable except objects are modified itself when modification methods such as DateTime::modify() are called. Warning Calling methods on objects of the class DateTime will change the information encapsulated in these objects, if you want to prevent that you will have to use Class synopsispublic setTime( public format(string } Changelog
Table of Contents
There are no user contributed notes for this page. date_modify(PHP 5 >= 5.2.0, PHP 7, PHP 8) DateTime::modify -- date_modify — Alters the timestamp DescriptionObject-oriented style public DateTime::modify(string Return Values Returns the modified DateTime object for method chaining or ExamplesExample #1 DateTime::modify() example Object-oriented style
Procedural style
The above examples will output: Example #2 Beware when adding or subtracting months
The above example will output: See Also
There are no user contributed notes for this page. |