#!/usr/bin/perl # # COUNTDOWN.CGI # by Matt Kruse (mkruse@saunix.sau.edu) # 7/26/95 # # This script will give you a "countdown" of the days until a # certain date. This can be used for things like saying "The new # software will be available in XX days" or "This product will arive # in stores in XX days". It will automatically stay up-to-date when # used in a server-side-include. It does not account for leap-years # because I didn't think that would be worth my time. If you *really* # need to account for Feb 29th, set your goal date one day later. # This does wrap days, so if it is Dec now and the goal is in # Jan, it will count correctly. # # This is a free script, but I would appreciate some e-mail if # you use it (it's an ego thing, I think :) Delete all these comments # to make the script smaller and easier to read. # # SET YOUR DATE HERE # ================== # Month must be 3 letters, and the first in caps. Space between month # and day is required. $GOAL="Jan 1"; # ================== %month= ( 'Jan',0,'Feb',31,'Mar',59,'Apr',90,'May',120,'Jun',151, 'Jul',181,'Aug',212,'Sep',243,'Oct',273,'Nov',304,'Dec',334 ); ($sec,$min,$hour,$mday,$mon,$year,$wday,$CURRENT,$isdst)=localtime(time); $CURRENT++; ($gmonth,$gday)=split(' ',$GOAL); $GOAL = $month{$gmonth} + $gday; if ($CURRENT > $GOAL) { $TOTAL=($GOAL+(364-$CURRENT)); } else { $TOTAL= $GOAL-$CURRENT; } print "Content-type: text/html\n\n$TOTAL";