Here's the code in action:
Monday 5th January 2009
<% ' This Code is Copyright Katy Whitton ' You are free to use this code on any site ' But Please Keep This Copyright Statement In ' Place ' For more ASP and JavaScripts, please visit ' http://www.katywhitton.com ' ' dim currentday, datenow, monthnow, yearnow '*********************************** ' Work out the day of the week and ' Then work out the name of the day '*********************************** IF weekday(now)=1 THEN currentday="Sunday" END IF IF weekday(now)=2 THEN currentday="Monday" END IF IF weekday(now)=3 THEN currentday="Tuesday" END IF IF weekday(now)=4 THEN currentday="Wednesday" END IF IF weekday(now)=5 THEN currentday="Thursday" END IF IF weekday(now)=6 THEN currentday="Friday" END IF IF weekday(now)=7 THEN currentday="Saturday" END IF '********************************** ' Work out what the date suffix is '********************************** IF Day(now)="1" OR Day(now)="21" OR Day(now)="31" THEN datenow=Day(now)&"st" ELSE IF Day(now)="2" OR Day(now)="22" THEN datenow=Day(now)&"nd" ELSE IF Day(now)="3" OR Day(now)="23" THEN datenow=Day(now)&"rd" ELSE datenow=Day(now)&"th" END IF END IF END IF '********************************** ' Work out the name of the month '********************************** if month(now)=1 THEN monthnow="January" END IF if month(now)=2 THEN monthnow="February" END IF if month(now)=3 THEN monthnow="March" END IF if month(now)=4 THEN monthnow="April" END IF if month(now)=5 THEN monthnow="May" END IF if month(now)=6 THEN monthnow="June" END IF if month(now)=7 THEN monthnow="July" END IF if month(now)=8 THEN monthnow="August" END IF if month(now)=9 THEN monthnow="September" END IF if month(now)=10 THEN monthnow="October" END IF if month(now)=11 THEN monthnow="November" END IF if month(now)=12 THEN monthnow="December" END IF '********************************** ' Put it all together and display ' it along with the year '********************************** Response.Write currentday&" "&datenow&" "&monthnow&" "&year(now)%>