php tutorials, php form validation
Archive Tutorials
Discussion Home
Login / Register

Board List
PHP programming
General

Links
How to save gas 25% or more
Marshall Reddick
Network Marketing Forums
Income Tax Help
Lose 10 Pounds in 3 Weeks
PHP Forum Script
Online Contest

Learn PHP in 47 hours!

Back to PHP programming

Search

php scripts for date php scripts for date

php scripts for date

by uclaboyz on Sun 02/12/2006 09:09 PM

Here is a very quick and dirty way to display date on your website. 

<?
echo date('m/d/Y');
?> 

When you run the above script you will see something this like: 

02/12/2006 

The php date() function takes in 2 parameters, with the 2nd argument being optional. 

The first argument is the format of your date.  In the example above, the 'm/d/Y' that you pass in the date() function tells PHP that you are want to display month (m), day of the month (d), and 4-digit year (Y), separated by /'s. 

If you want to change the seperator of your month, day, year, you may do so by changing the format you pass in the date() function. 

Such as date('m-d-Y') will give you 02-12-2006 

You may even change the month/day/year order around, such as date('Y/m/d') will give you 2006/02/12.

[Reply] [Back to Top]

© Copyright 2006-2007.  All Rights Reserved. Site hosted by Small Business Web Design
how to start a blog | parenting tips website | Passive Income | baby websites