I have a D5 view that uses argument handling code to dynamically filter events for an academic year. In Drupal 6, I've upgraded from the events module to using the CCK date field, so the date would not be a timestamp any longer. That's easy enough, but I'm not sure how to get the equivalent filter functionality Drupal 6.
Has anyone tried something like this or does anyone know how to achieve the end result in some other way?
Argument Handling Code
$view->is_cacheable = 0;
if(date("n") <= 6) {
// second, minute, hour, month, day, year
$year_begin = mktime(0, 0, 0, 7, 1, date("Y")-1);
$year_end = mktime(0, 0, 0, 6, 30, date("Y"));
} else {
$year_begin = mktime(0, 0, 0, 7, 1, date("Y"));
$year_end = mktime(0, 0, 0, 6, 30, date("Y")+1);
}
$view->description = strftime('%B %e, %Y',$year_begin) . ' - ' . strftime('%B %e, %Y',$year_end);
$view->filter[] = array(
'vid' => $view->vid,
'tablename' => '',
'field' => 'event.event_start',
'value' => strftime('%Y-%m-%d',$year_begin),
'operator' => '>',
'options' => '',
'position' => count($view->filter),
'id' => event.event_start,
);
$view->filter[] = array(
'vid' => $view->vid,
'tablename' => '',
'field' => 'event.event_start',
'value' => strftime('%Y-%m-%d',$year_end),
'operator' => '<',
'options' => '',
'position' => count($view->filter),
'id' => event.event_start,
);

Comments
I just had to do something
I just had to do something similar, to get all items for single calendar week (eg, always Monday-Friday). I found this documentation on flexible date arguments: http://groups.drupal.org/node/1362
The code I ended up using for the default argument:
<?php
// Saturday is the last day in a week.
$current_day = date('w');
$start = strtotime("-$current_day days");
// Date module argument formats are documented here:
// http://groups.drupal.org/node/1362
return date('Y-m-d', $start) . '--P1W';
?>
That "P1W" is the date module-specific syntax, in this case, it means the week starting on $start.
For your use case, it looks like you would want to calculate your start and end dates, then use something like this:
"2006-02--2006-03-15 >> Feb 1 2006 to Mar 15 2006"
Thanks!
That's exactly what I needed and works like a charm.