PHP Date Syntax & Example

Example of Date function in PHP

<?php
echo "Today is ".date("d")."<br>";
echo "Today is ".date("js")."<br>";
echo "Month is ".date("F")."<br>";
echo "Month is ".date("m")."<br>";
echo "Month is ".date("n")."<br>";
echo "Month is ".date("M")."<br>";
echo "Year is ".date("Y")."<br>";
echo "Year is ".date("y")."<br>";
echo "Full Date is ".date("d/m/Y")."<br>";
echo "Full Date is ".date("y/m/d")."<br>";
echo "week Day is ".date ("D")."<br>";
echo "week Day is ".date ("N")."<br>";
echo "week Day is ".date ("L")."<br>";
echo "Day is ".date("Z")."<br>";
echo "Week of the year ". date("W")."<br>";
echo "Is This is leap year". date("L");
?>

OutPut:

Today is 6
Today is 6th
Month is May
Month is 05
Month is may
Year is  2022
Year is 22
Full Date Is  6/05/2022
Full Date Is  2022-May-6
Week Day is  Fri
Week Day is  Friday
Week Day is 5
Day is 125 
Week of the year=18
NO
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x