How to get the time in a few days in php

藏色散人
Release: 2023-03-10 08:02:01
Original
4615 people have browsed it

php method to get the time in a few days: first create a PHP sample file; then use "date("Y-m-d H:i:s",strtotime("3 day"));" to get the time in 3 days Time is enough.

How to get the time in a few days in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

php method to get the time and date after N days

Example 1: php gets the time and date after 3 days

Code:

Copy after login

Output result:

2019-11-07 23:23:25 2019-11-10 23:23:25
Copy after login

Example 2: php gets the time after n days Date function

Function code:

Copy after login

Function call:

Copy after login

Supplementary instructions:

Flexibly use PHP’s strtotime(), you can also get The time and date are N hours before, N hours after, one week ago, one month after, etc. of the current time.

Example:

Copy after login

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to get the time in a few days in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!