Note that is not advisable to use an in built value as your field in either programming script nor in a database you can try to change the field name DATE to some thing else
atplerry
Junior Poster in Training
58 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0
>The problem comes when I have a form with a date field wich need to be in YYYY-MM-DD format. You would get, in instance, with PHP, a variable with a value like this: '25-12-2007' (that would be Christmas day :P). How do I store that in the database? For PHP it is a string, and there's nothing to convert a string to a date.Note that the date is entered manually by the user, I don't get it automatically with a date() or whatever.
Well obviously the ideal solution would be to convert '25-12-2007' to '2007-12-25' immediately then store it in the database.
If you are allowing the user to enter it in, then you need to validate it is entered in the correct format. A simple regular expression would suffice here. Presumably anyone using mysql is using it with another more flexible programming language, for example, php where regular expressions can be used.
iamthwee
Posting Genius
6,367 posts since Aug 2005
Reputation Points: 1,567
Solved Threads: 489
Skill Endorsements: 35