$today ) $request_date = $today; $comic_image = toDays( $request_date ) - toDays( $start_from_date ) + 1; switch( $comic_image ) { case ( ( $comic_image / 10 ) < 1 ): $comic_image = "0000" . $comic_image . ".png"; break;; case ( ( $comic_image / 100 ) < 1 ): $comic_image = "000" . $comic_image . ".png"; break;; case ( ( $comic_image / 1000 ) < 1 ): $comic_image = "00" . $comic_image . ".png"; break;; case ( ( $comic_image / 10000 ) < 1 ): $comic_image = "0" . $comic_image . ".png"; break;; case ( ( $comic_image / 100000 ) < 1 ): $comic_image = $comic_image . ".png"; break;; } $prev_date = prevDate( $request_date ); $next_date = nextDate( $request_date ); function prevDate( $date ) { # dechipering the date $year = split( "-", $date ); $year = $year[0]; $month = split( "-", $date ); $month = $month[1]; $day = split( "-", $date ); $day = $day[2]; --$day; if ( checkdate( $month, $day, $year ) ) { if ( $day < 10 ) $day = "0" . $day; return $year . "-" . $month . "-" . $day; } $day="31"; --$month; if ( checkdate( $month, $day, $year ) ) { if ( $month < 10 ) $month = "0" . $month; return $year . "-" . $month . "-" . $day; } $day="30"; if ( checkdate( $month, $day, $year ) ) { if ( $month < 10 ) $month = "0" . $month; return $year . "-" . $month . "-" . $day; } $mount="12"; --$year; if ( checkdate( $month, $day, $year ) ) return $year . "-" . $month . "-" . $day; } function nextDate( $date ) { # dechipering the date $year = split( "-", $date ); $year = $year[0]; $month = split( "-", $date ); $month = $month[1]; $day = split( "-", $date ); $day = $day[2]; ++$day; if ( checkdate( $month, $day, $year ) ) return $year . "-" . $month . "-" . $day; $day = "01"; ++$month; if ( checkdate( $month, $day, $year ) ) return $year . "-" . $month . "-" . $day; $month = "01"; ++$year; if ( checkdate( $month, $day, $year ) ) return $year . "-" . $month . "-" . $day; } function toDays( $date ) { # dechipering the date $year = split( "-", $date ); $year = $year[0]; $month = split( "-", $date ); $month = $month[1]; $day = split( "-", $date ); $day = $day[2]; # add days in year if( leap_year( $year ) ) $day += $year * 365; else $day += $year * 364; # add days in month switch( $month - 1) { case '11': $day += 30; case '10': $day += 31; case '9': $day += 30; case '8': $day += 31; case '7': $day += 31; case '6': $day += 30; case '5': $day += 31; case '4': $day += 30; case '3': $day += 31; case '2': if ( leap_year( $year ) ) $day += 29; else $day += 28; case '1': $day += 31; } return $day; } function leap_year( $year ) { // By default it is not! :) $leap_year = false; if( $year % 4 ) $leap_year = true; if( $year % 400 ) $leap_year = true; if( $year % 100 ) $leap_year = false; return $leap_year; } ?> Postcards

<previous' ); else print( '
 
' ); ?>
"; ?> next>' ); else print( '
 
' ); ?>

Courtesy of Ivan Miskovic