Format today's date in several ways

Do you want to display today's date in your code? Easy enough, right!

Well what if you wanted to format today's date in a different way? Use the following code to do that!

Code: Select all

<!DOCTYPE html>

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");

The output will look like this:

Today is 2017/02/21
Today is 2017.02.21
Today is 2017-02-21
Today is Tuesday

There are many variations you can do!

Who is online

Users browsing this forum: No registered users and 0 guests