Sarah
|
| Posted: 03/14/2002, 11:35 AM |
|
I used the example here> http://www.gotocode.com/art.asp?art_id=132& to format some dates, but for some reason if there was no date submitted,(the database has 0000-00-00), the instead of 00-00-0000 showing on the record page, it shows 12/31/1969. I have no idea where that date came from. Anyone no what the problem is?
|
|
|
 |
CodeCharge Support
|
| Posted: 03/15/2002, 2:27 AM |
|
Sarah,
to display empty date (or any temp date value) when it equals to "0000-00-00" you should improve format date function code. E.g. in such way:
switch ($format)
{
case 1:
if (($year=="")||($month=="")||($day==""))
$res = "00/00/0000";
else
$res = date("d/m/Y", mktime(0,0,0, $month, $day, $year));
break;
case 2:
if (($year=="")||($month=="")||($day==""))
$res = "00/00/0000";
else
$res = date("m/d/Y", mktime(0,0,0, $month, $day, $year));
break;
case 3:
if (($year=="")||($month=="")||($day==""))
$res = "00-00-0000";
else
$res = date("d-m-Y", mktime(0,0,0, $month, $day, $year));
break;
}
|
|
|
 |
CodeCharge Support
|
| Posted: 03/15/2002, 2:27 AM |
|
Sarah,
to display empty date (or any temp date value) when it equals to "0000-00-00" you should improve format date function code. E.g. in such way:
switch ($format)
{
case 1:
if (($year=="")||($month=="")||($day==""))
$res = "00/00/0000";
else
$res = date("d/m/Y", mktime(0,0,0, $month, $day, $year));
break;
case 2:
if (($year=="")||($month=="")||($day==""))
$res = "00/00/0000";
else
$res = date("m/d/Y", mktime(0,0,0, $month, $day, $year));
break;
case 3:
if (($year=="")||($month=="")||($day==""))
$res = "00-00-0000";
else
$res = date("d-m-Y", mktime(0,0,0, $month, $day, $year));
break;
}
|
|
|
 |
|