/    Sign up×
Community /Pin to ProfileBookmark

I’m looking for an easy javascript date clock to go on a web page. in the form:

24th September 2006

Anyone seen one?

to post a comment
JavaScript

11 Comments(s)

Copy linkTweet thisAlerts:
@felgallSep 05.2006 — So simple I'll just write it here:

var today = new Date();
var dd = today.getDate();
switch (dd) {
case 1: 21: 31: dd+= 'st '; break;
case 2: 22: dd+= 'nd '; break;
case 3: 23: dd+= 'rd '; break;
default: dd+= 'th ';}
var month = ['January','February,'March','April','May','June','July','August','September','October','November','December'];
dd += month(today.getMonth()) + ' ' + today.getFullYear();
document.write(dd);
Copy linkTweet thisAlerts:
@holliebelleauthorSep 05.2006 — Hi Stephen,

Thanks.. pasted that code and it didn't work!
Copy linkTweet thisAlerts:
@felgallSep 05.2006 — What error did it give?
Copy linkTweet thisAlerts:
@holliebelleauthorSep 05.2006 — http://www.thinktank.net.au/eric/header.html

no error, just dodnt show up.

Should be on the left hand side.

Can you see what i did wrong?
Copy linkTweet thisAlerts:
@felgallSep 05.2006 — Where I wrote:

case 1: 21: 31:

I should have written:

case 1: case 21: case 31:

and similarly for the following two lines.
Copy linkTweet thisAlerts:
@holliebelleauthorSep 05.2006 — Hi Stephen,

Changed those.. still not working!!

http://www.thinktank.net.au/eric/header.html
Copy linkTweet thisAlerts:
@felgallSep 05.2006 — Closing quote missing after February. Should be February','March
Copy linkTweet thisAlerts:
@holliebelleauthorSep 05.2006 — Fixed that up... still nothing.
Copy linkTweet thisAlerts:
@JMRKERSep 06.2006 — Change:
[code=php]
dd += month(today.getMonth()) + ' ' + today.getFullYear();
[/code]

To:
[code=php]
dd += month[today.getMonth()] + ' ' + today.getFullYear();
[/code]
Copy linkTweet thisAlerts:
@holliebelleauthorSep 06.2006 — bingo.

thank you.
Copy linkTweet thisAlerts:
@felgallSep 06.2006 — One of the problems with typing in scripts straight out of your head is that you tend to make an occasional typo along the way although I don't normally make so many.
×

Success!

Help @holliebelle spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...