Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-08-2008, 01:50 PM
Member
 
Join Date: Jan 2008
Posts: 2
desktop_doodle is on a distinguished road
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:

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>
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:

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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-08-2008, 04:23 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Quote:
Originally Posted by desktop_doodle View Post
....
<SCRIPT language=javascript>
...
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?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-08-2008, 05:53 PM
Member
 
Join Date: Jan 2008
Posts: 2
desktop_doodle is on a distinguished road
Yes,
I'm sorry - you're absolutely right. I have posted in error, thinkin that this was a javascript forum. My apologies. And to answer yuor question, yes I have tried W3 - its usually my first port of call for any queries, but to no avail.

Mike B
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
countdown timer, little help with method sidy New To Java 22 07-19-2008 01:42 PM
Difference between current date and anothe date vijay balusamy New To Java 1 04-16-2008 05:15 PM
CountDown timer Seema Sharma AWT / Swing 1 03-06-2008 05:26 PM
java.util.Date vs java.sql.Date Jack New To Java 1 07-09-2007 04:22 AM
oracle query with date question orchid Database 1 05-09-2007 01:10 AM


All times are GMT +3. The time now is 02:26 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org