![]() |
| ||||||||
|
|||||||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
|
Advanced Warrior
Join Date: Jan 2007
Location: Geneva, Switzerland
Posts: 685
Thanks: 65
Thanked 6 Times in 6 Posts
|
Hi all,
I'm having enormous trouble with JavaScript (possibly because I don't know the first thing about it). I'm using a short script to display tomorrow's date (which changes dynamically whenever you visit the site). The code is as follows: Code:
<script> var tomorrow = new Date (); tomorrow.setDate (tomorrow.getDate() + 1) document.write(tomorrow + ". "); </script> What I'm trying to do is to get it to display just the day (e.g., April 1, 2009). Any idea how to do that? |
|
Recession Job Hunter Blog - How to Find Paying Jobs in the Middle of the Economic Meltdown!
|
|
|
|
|
|
|
#2 |
|
Banned
Join Date: Mar 2009
Location: florida
Posts: 44
Thanks: 0
Thanked 3 Times in 2 Posts
|
Have you done a google search for javascript tutorials
|
|
|
|
|
|
#3 |
|
Yes that's my true photo
War Room Member
Join Date: Sep 2003
Location: Stockport, United Kingdom.
Posts: 1,457
Thanks: 38
Thanked 48 Times in 42 Posts
|
|
|
Have you joined yet? Warrior Women Go Here
|
|
|
|
|
| The Following User Says Thank You to Janet Sawyer For This Useful Post: |
|
|
#4 |
|
Advanced Warrior
Join Date: Jan 2007
Location: Geneva, Switzerland
Posts: 685
Thanks: 65
Thanked 6 Times in 6 Posts
|
Janet,
Thanks a lot - this script works, but I still have the problem with the result being displayed as: Wed Apr 01 2009 21:00:23 GMT+0200 (Romance Daylight Time). Is there a way to make it show April 1, 2009, rather than the whole long thing (it looks hideous)? |
|
Recession Job Hunter Blog - How to Find Paying Jobs in the Middle of the Economic Meltdown!
|
|
|
|
|
|
|
#5 |
|
Advanced Warrior
Join Date: Jan 2007
Location: Geneva, Switzerland
Posts: 685
Thanks: 65
Thanked 6 Times in 6 Posts
|
Never mind, got it - all it took was the following:
Code:
document.write(tomorrow.toLocaleDateString()); |
|
Recession Job Hunter Blog - How to Find Paying Jobs in the Middle of the Economic Meltdown!
|
|
|
|
|
|
|
#6 |
|
HyperActive Warrior
|
Can a moderator please move this to the Programming forum?
Regards, Allen |
|
|
|
|
|
|
![]() |
|
| Tags |
| date, javascript, needed, tomorrow |
| Thread Tools | |
|
|
![]() |