How to remove 0 from date in php

藏色散人
Release: 2023-03-08 17:52:02
Original
3472 people have browsed it

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() ):
Copy after login

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!

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template