morrisjohnny Posted August 30, 2006 Share Posted August 30, 2006 In Reguards to the Month I Solved it I'm now having trouble Getting the Date as in the 1st or 27th ectAnyway I Have bene using the The code for getting the weekday ( from w3schools )From here To Do the Day & Month But i really can't figure out how to get the date since u they use the same variables or don't they? Someone exapling PLeaseCheers in advance-Jny Mris Link to comment Share on other sites More sharing options...
skym Posted August 30, 2006 Share Posted August 30, 2006 <html><body><script type="text/javascript">var d=new Date()var weekday=new Array(7)weekday[0]="Sunday"weekday[1]="Monday"weekday[2]="Tuesday"weekday[3]="Wednesday"weekday[4]="Thursday"weekday[5]="Friday"weekday[6]="Saturday"document.write("Today it is " + weekday[d.getDay()] + ", " + d.getDate());</script></body></html> Link to comment Share on other sites More sharing options...
morrisjohnny Posted August 30, 2006 Author Share Posted August 30, 2006 Thts wht i can get, I want the Date as in like somthing the <b>5th</b> of somethingor something the <b>25</b> of something like the number as in the date not the month or day, Sorry i hope its become clearer-Jny Link to comment Share on other sites More sharing options...
reportingsjr Posted August 30, 2006 Share Posted August 30, 2006 If you want you could also use SSI (Server Side Includes). This can be done easily with HTML. I saw a thing on it before where it can get the weekday if you have two tags, not as complex and alot less code... Im not sure about the month though. I bet you can.. Just search HTML includes on google and look at them all until you find it! Link to comment Share on other sites More sharing options...
skym Posted August 30, 2006 Share Posted August 30, 2006 I don't think there is a code to directly output the 'st', 'nd', 'rd' and 'th' suffixes. Why not making your own code to put the correct suffix? <script type="text/javascript">var d=new Date()var weekday=new Array(7)weekday[0]="Sunday"weekday[1]="Monday"weekday[2]="Tuesday"weekday[3]="Wednesday"weekday[4]="Thursday"weekday[5]="Friday"weekday[6]="Saturday"date = d.getDate();switch (date){case 1: suffix = 'st'; break;case 2: suffix = 'nd'; break;case 3: suffix = 'rd'; break;default: suffix = 'th';}document.write("Today it is " + weekday[d.getDay()] + ", " + date + suffix);</script> Link to comment Share on other sites More sharing options...
aspnetguy Posted August 30, 2006 Share Posted August 30, 2006 what about the 22th and 23th ? Link to comment Share on other sites More sharing options...
skym Posted August 30, 2006 Share Posted August 30, 2006 what about the 22th and 23th ? Right, but let him complete the code Link to comment Share on other sites More sharing options...
aspnetguy Posted August 30, 2006 Share Posted August 30, 2006 I am just ribbing you, :lol I like to do that Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now