What is date function in PHP

date () for date output: Date and time for programming

The date can be output in PHP in various formats. The function is used for this.

After the echo output, the function is chained via the point.

The attributes mean:
d = two-digit day
m = month as a two-digit number
y = two-digit year
Y = four-digit year

The result in the browser:

Today's date: 02/21/2021

Today's date: 02/21/21

The above example shows the problem of two-digit years. The uniqueness is getting worse - please remember that the order of day, month and year depends on the country. In some regions of the world year-month-day is also used as a standard.

If the following error message appears (which will be the case with current PHP installations from PHP 5.1: "Warning: date () [function.date]: It is not safe to rely on the system's timezone settings. You are * required * to use the date.timezone setting or the date_default_timezone_set () function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe / Paris' for '2.0 / DST' instead in D: \ xampplite \ htdocs \ fileinamephpprogramm.php on line x "then please enter the command at the beginning of your program date_default_timezone_set ('Europe / Berlin'); for Germany: "

Help on functions

Since PHP has a large number of functions and these offer numerous attributes, many programmers use the help via php.net

After the function has been entered, you get the structure and the possible attributes.

Task: Display the date in different ways

Display the date in various ways - including the time. For information on how to do it, please use php.net.

Today's date: 02/21/2021

Today's date: Feb 21, 21

Today's date: Sun Feb 21, 2021 1:43:05 PM

If you find a bug, please let us know (regardless of whether spelling mistakes or errors in content).

With a mouse Mark the faulty point and take over with the following button:

After submitting it comes here feedback! Please do not send twice. Thanks.