Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

manipulating dates for insertion in MySQL

Codes here !

Moderators: macek, egami, gesf

manipulating dates for insertion in MySQL

Postby kunal_it » Tue Oct 15, 2002 11:40 am

I've date in a string format like 10/15/2002.

Is there a PHP function which can convert this into a format for insertion in mysql table in a field of type datetime.

Additionally, if i want to add 30 days to the date entered in the HTML form (say, for the expiry date ), how do I add these 30 days ?

If this can somehow be achieved by changing the datatype of mysql field, then, that too is acceptable..

Your comments on this!

Thanks,
Kunal
kunal_it
New php-forum User
New php-forum User
 
Posts: 4
Joined: Tue Oct 15, 2002 10:26 am
Location: Raleigh

Postby DoppyNL » Tue Oct 15, 2002 12:26 pm

If you format the date as a normal date, mysql will accept that and place the correct date in the database.
For a desciption on what formats are supported, see the manual at mysql.org.

Greetz Daan
DoppyNL
 

Postby Jay » Tue Oct 15, 2002 1:30 pm

MySQL has got features that will handle you adding dates to them, you need to read chapter 6 (6.4 I think) on data types, and in the date & time section it'll list all the types and how to set them!
Jay
 


Return to mySQL & php coding

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron