03
Feb
2011

PHP code to display Date and Time

Posted in: PHP No Comments


Below is PHP code to display Date and time.

<?php
echo date("D M d, Y H:i:s");
?>

In above code;
D -> Display day example Sunday
M -> Display month example January
d -> Display date, example 23
Y -> Display Full year example 2011
y -> Display Year in two digit example 11
g -> Display hours in 12 hour format without leading zeros ie. 7
H -> Display hours in 24 hour format with leading zeros ie. 17
h -> Display hours in 12 hour format with leading zeros ie. 07
i -> Display minutes example 42
s -> Display Seconds example 16

About the Author

Name: Ravi Shekhar
I love learning and sharing web stuffs.

Share this post

Twitter Facebook Google Buzz Digg StumbleUpon Delicious Technorati

Leave a Reply