Learn PHP Programming

A backend server scripting language, and a powerful tool for making dynamic and interactive Web pages. Learn each topic with examples and output.

PHP Introduction
Control Structures
Php Forms
Php Advanced

PHP Date and time

The PHP date() function formats a timestamp to a more readable date and time.

Get a Date

The required format parameter of the date() function specifies how to format the date (or time).

Here are some characters that are commonly used for dates:

The example below formats today's date in three different ways:

<?php
    echo "Today is " . date("Y/m/d") . "<br>";
    echo "Today is " . date("Y.m.d") . "<br>";
    echo "Today is " . date("Y-m-d") . "<br>";
    echo "Today is " . date("l");
    ?>

In next chapter we will learn date and time function


Share this page on :

=