Format today's date in several ways

#1
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>
<html>
<body>

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

</body>
</html>
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 1 guest

cron