Results 1 to 3 of 3
- 01-08-2008, 12:50 PM #1
Member
- Join Date
- Jan 2008
- Posts
- 2
- Rep Power
- 0
Please Help - Java Date/Countdown Query
Hi,
I have a bit of simple code which serves to display the current date and also a countdown to Jan 31st and is to remind people to file their tax returns. Here is the code:
The code works fine, in that it shows the date and it counts down. The problem is that it displays the date in long format, like this:Java Code:<DIV align=center><H1><SCRIPT language=javascript> <!-- Today = new Date(); TodayYear = Today.getYear(); if (TodayYear < 2000) TodayYear += 1900; // put your date here DateToFind = new Date("January 31, " + TodayYear); difference = DateToFind.getTime() - Today.getTime(); difference = Math.floor(difference / (1000 * 60 * 60 * 24)) + 1; note = "<br> Call us NOW - <strong> 01452 527 000</strong>"; note2 = "Today is "; note3 = "<br><strong>Just "; if (difference < 0) { difference = 365 - difference; TodayYear = TodayYear + 1; note = " +/-1"; } document.write(note2 + Today + note3 + difference + " days</strong> from the deadline for filing your tax return " + note); --> </SCRIPT></H1></DIV>
Tue Jan 08 2008 11:43:02 GMT+0000 (GMT Standard Time)
How can I edit it so that it only shows up Tuesday, January 8th, 2008 - without the time/GMT etc?
Any help would be greatly appreciated as I'm rather new to javascript. I have tried searching everywhere and can't find anything anywhere to help me change the date display.
Can anyone help?
Many thanks in advance
Mike B
- 01-08-2008, 03:23 PM #2
Correct me if I'm wrong, but the code you posted is javascript... no? Javascript != Java(this is the Java Forums, not Javascript Forums :)) Have you tried w3schools?
Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice? Vote now!
Got a little Capt'n in you? (drink responsibly)
- 01-08-2008, 04:53 PM #3
Member
- Join Date
- Jan 2008
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
java.util.Date vs java.sql.Date
By Jack in forum New To JavaReplies: 5Last Post: 10-28-2010, 02:59 PM -
countdown timer, little help with method
By sidy in forum New To JavaReplies: 22Last Post: 07-19-2008, 12:42 PM -
Difference between current date and anothe date
By vijay balusamy in forum New To JavaReplies: 1Last Post: 04-16-2008, 04:15 PM -
CountDown timer
By Seema Sharma in forum AWT / SwingReplies: 1Last Post: 03-06-2008, 04:26 PM -
oracle query with date question
By orchid in forum JDBCReplies: 1Last Post: 05-09-2007, 12:10 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks