manipulating dates for insertion in MySQL

Codes here !

Moderators: macek, egami, gesf

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

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!



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

Greetz Daan


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!

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 3 guests