Home >Backend Development >PHP Problem >How to remove 0 from date in php

How to remove 0 from date in php

藏色散人
藏色散人Original
2021-03-15 09:39:263522browse

How to remove 0 from php date: First open the corresponding PHP file; then change the date method to "date('Y-n-j', time())".

How to remove 0 from date in php

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

About whether there is 0 in the PHP date prefix

For example: 2018-01-04, the date and month are preceded by 0

If you don’t want to have 0, date('y-n-j',time()); The default is date('y-m-d',time()), the date and month are preceded by 0.

date('Y-n-j',time())和date( 'y-m-d',time() ):

m, n is the month, do not add 0 in front of n;; d, j is the date, do not add 0 in front of j.

[Recommended learning: "PHP Video Tutorial"]

The above is the detailed content of How to remove 0 from date in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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