Ron Borkent
|
| Posted: 02/11/2002, 1:57 AM |
|
Maybe you already have something like this but for those that are stil having trouble with converting date formats with mysql here are two functions I wrote:
// show mysql format 0000-00-00 as european format 00-00-0000
function showdbdate($field)
{
$day = substr($field, 8, 2);
$month = substr($field, 5, 2);
$year = substr($field, 0, 4);
$field= $day . "-" . $month . "-" .$year;
return $field;
}
//insert update format 00-00-0000 to db as format 0000-00-00
function dbdate($field)
{
$day = substr($field, 0, 2);
$month = substr($field, 3, 2);
$year = substr($field, 6, 4);
$field= $year . "-" . $month . "-" .$day;
return $field;
}
Add these functions in modules under global functions
Use the first one in before show event like this
$fldyour_date_field= showdbdate($fldyour_date_field);
and the second one in the before insert or before update event like this:
$fldyour_date_field=dbdate($fldyour_date_field);
Hope it is usefull for someone
Ron
|
|
|
 |
ocougar
|
| Posted: 06/26/2002, 3:51 AM |
|
Thanks,
was very useful ! 
Walter
|
|
|
 |
|