Programming Resources

Using dates with PHP and mySQL

How to specify dates using PHP and a mySQL database

 

 

Best not to use mySQL datestamps as these will need
converting to UNIX timestamps for ease of use in PHP.

Best to create UNIX timestamps in PHP and then insert into
mySQL tables as a text variable (eg. varchar(14)).

Creating a UNIX timestamp
Create a timestamp of the current date/time:
$now = strtotime('now');

Other dates:
$mydate = strtotime('12-May-2003');
Any 'typical' date format is recognised, note that if the date format is not recognised then -1 is returned.

Formatting a timestamp:
$mydate=date('M-D-Y');

 

If you are looking for property in Piemonte Italy then we recommend alba property and piedmont property. Italian real estate.

Home > Programming Resources > PHP > Using dates with PHP and mySQL

Contact

Telephone: 020 7193 2301
Email: webcontact@fearntech.co.uk

Full Contact Details >

 

© 2001-2008 Fearntech Limited. All rights reserved.
website design kent | seo kent | website maintenance
Valid XHTML | Valid CSS