$thisdate = gmdate('Y-m-d', strtotime($row['bDatetime']));
if ($thisdate != $lastdate && $lastdate != NULL) {
echo "\t<date count=\"". $count .'" date="'. $lastdate ."\" />\r\n";
$count = 1;
$thisdate = gmdate('Y-m-d', strtotime($row['bDatetime']));
if ($thisdate != $lastdate && $lastdate != NULL) {
echo "\t<date count=\"". $count .'" date="'. $lastdate ."\" />\r\n";
$count = 1;