|
Posted by NC on 10/21/74 11:59
awebguynow wrote:
>
> My 1st priority has been for simplicity, so I have used
> std. MySQL format for the text input that feeds into the
> table.Column.
>
> There are problems with that
The only real problem is that MySQL supports wider range
of dates than PHP does. The rest is a matter of convention.
> Obviously, choosing another format for forms-reports
> would require manipulation of date to/from DB. What
> is the best way this be implemented with consistency ?
function date2date($string, $format = 'Y-m-d') {
$ts = strtotime($string);
if ($ts == -1) {
return false;
} else {
return date($format, $ts);
}
}
To convert a string representation of a date into the MySQL
format, call
date2date('September 25, 2006');
To present the date retrieved from MySQL in the format of
yout choice, call
date2date($date_from_MySQL, 'Format of your choice');
> Mode System: Current or Historical ?
I'm afraid I don't understand what this means... Would you
care to elaborate?
Cheers,
NC
Navigation:
[Reply to this message]
|