Originally posted by bhola
well that was easy. yay PHP!! i have another question now. this form will reside on 2 different servers. one here in US and one in Europe. i would like to have a php script that would check the server name (or some unique identifier) and depending on the location would either write the date as d-m-Y for Europe or m-d-Y for US.
any ideas or links to helpful info appreciated.
From the mysql manual:
Although MySQL tries to interpret values in several formats, it always expects the year part of date values to be leftmost. Dates must be given in year-month-day order (for example, '98-09-04'), rather than in the month-day-year or day-month-year orders commonly used elsewhere (for example, '09-04-98', '04-09-98').
so if you use a date or datetime field in MySQL you should always put the date in YYY-MM-DD HH:mm:SS format.
The other alternative is to store the date as an integer value, (epoch timestamp). int(10) unsigned
$timestamp = time();
Mixing up the formats of the date field will give you incorrect results when you try and sort the data. You can store it as a char column and then parse the string.
I suggest storing it as an int and setting another field for the timezone or for the region and using that field to determine how to display the data.
check out this article about timezones.
http://www.phpbuilder.com/columns/ehresman20030911.php3