Home  >  Article  >  Backend Development  >  What does date mean in php

What does date mean in php

WBOY
WBOYOriginal
2022-02-11 15:11:303127browse

In PHP, date means "date". The date() function can format the timestamp into a more readable date and time. Setting the parameters in the function can specify the format of the timestamp. , the syntax is "date(string $format int $timestamp)".

What does date mean in php

The operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer

What does date mean in php

PHP date() function is used to format time/date.

PHP date() function can format the timestamp into a more readable date and time.

Tip timestamp is a character sequence that represents the date/time when a certain event occurred.

Syntax

string date ( string $format [, int $timestamp ] )

Parameter Description

format Required. Specifies the format of the timestamp.

timestamp Optional. Specify timestamp. The default is the current date and time.

Here are some available characters:

  • d - represents the day of the month (01 - 31)

  • m - represents the month (01 - 12)

  • Y - represents the year (four digits)

You can insert other characters between the letters Characters, such as "/", "." or "-", so that you can add additional formats:

The example is as follows:

";
echo date("Y.m.d") . "
"; echo date("Y-m-d"); ?>

The output of the above code is as follows:

What does date mean in php

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What does date mean 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