ARGH! php/mySQL problem (aka I am stupid)

Message Bookmarked
Bookmark Removed
I have a simple thing that I'm trying to do and can't make it work. Please help my stupid brain.

HTML form (processed with PHP), user-entered date, insert to MySQL as smalldatetime. How?

I can't convert the user-entered string to make it go in as a date. In the end I need to sort by these dates. There has to be a way.

Ms Misery (MsMisery), Monday, 11 December 2006 16:21 (seventeen years ago) link

Mysql's date format is different. I don't know it offhand but you should read the input date with:

http://us3.php.net/strtotime

and then

use FROM_UNIXTIME (32498892345982) around the unix timestamp in your sql

jw (ex machina), Monday, 11 December 2006 16:28 (seventeen years ago) link

hmm, I will try this. after lunch!

Ms Misery (MsMisery), Monday, 11 December 2006 17:19 (seventeen years ago) link

MySQL: All the fucked-up datatypes of MSSQL, but none of the handy casts.

Oddly enough, staying here I saw seven golden bowls make cakes and religion (goo, Tuesday, 12 December 2006 03:19 (seventeen years ago) link

SmallDateTime.

What's that all about then?

M Grout (Mark Grout), Tuesday, 12 December 2006 12:48 (seventeen years ago) link


You must be logged in to post. Please either login here, or if you are not registered, you may register here.