Hi, I need to work with a MYSQL time in the format '2008-05-06T08:30:00', checking the day of the week until some date, and add table entrys if there's a match.
What's the easiest way to format that MYSQL date??
This leaves off the leading zeros...
list($year, $month, $day, $hour, $minute, $second) =
sscanf($node->field_time[0]['value'], '%d-%d-%dT%d:%d:%d');
list($year, $month, $day, $hour, $minute, $second) = sscanf($node->t1, '%d-%d-%dT%d:%d:%d');
$start_second = mktime($hour, $minute, $second, $month, $day, $year);
$current_second = $start_second;
$n = 1;
$weeks_to_try = 3;
$end_second = $start_second + (60 * 60 * 24 * 7) * $weeks_to_try;
while($current_second <= $end_second)
{
$current_second = mktime($hour, $minute, $second, $month, ($day + $n), $year);
if(in_array(date('l', $current_second), $node->repeatdays)) { //save it
list($n_month, $n_day, $n_year) = explode('/', date('m/d/Y', $current_second));
$node->field_time_value[0]['value'] = "{$n_year}-{$n_month}-{$n_day}T{$hour}:{$minute}:{$second}";
}
$n++;
}
Thanks for any help