Converting string to date

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
utahfriend
Forum Commoner
Posts: 34
Joined: Thu Nov 10, 2005 12:25 pm
Location: Bountiful, Utah

Converting string to date

Post by utahfriend »

I am using PHP with Mysql. I have a string that I want to store in a date field in MySql. I can get the text in the format (YYYY-mm-dd) but how do I convert it so it will store in the date field?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

as long as you give it to mysql in their date format there's nothing to do. Just remember to give it as a string (quoted) or you'll ask MySQL to store the result of some math ;)
Post Reply