Show Date and Time
Published on: 2005-08-14 - Views: 15579
Browsing several sites you have seen that they have date or time displayed in real time, you were wondering how to have it on your own site and, browsing the net, you landed here. Good. In a few minutes you'll have your hour and time showing up in your pages.
Displaying Date and Time is possible and very easy thanks to PHP date() function; let's see how it works:
1- <?php date("Y-m-d"); ?>
2- <?php date("D M j G:i:s T Y"); ?>
3- <?php date("H:i:s"); ?>
4- <?php date("F j, Y, g:i a"); ?>
Your output will be:
2- <?php date("D M j G:i:s T Y"); ?>
3- <?php date("H:i:s"); ?>
4- <?php date("F j, Y, g:i a"); ?>
1- 2006-09-09
2- Sat Sep 9 4:13:18 CDT 2006
3- 04:13:18
4- September 9, 2006, 4:13 am
These are only a few exmaples of what you can do with it.2- Sat Sep 9 4:13:18 CDT 2006
3- 04:13:18
4- September 9, 2006, 4:13 am
There are really lots of ways that you can customize your data format, go here to browse all the formats you can obtain with the date() PHP function.
You can obviously use this function even for other purposes..for example you can store the date into a variable and use it into a MySQL query or in any other way.

