/    Sign up×
Community /Pin to ProfileBookmark

Time and date script.

Hi. Is there a script to display time and date, the same your pc displays? I need help here, please. Thank u in advance.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Kobushi_no_KamiauthorApr 27.2003 — Yep, thanks so much
Copy linkTweet thisAlerts:
@CharlesApr 27.2003 — [font=georgia]You'll find though, that it doesn't work. There is no [font=monospace]Date.toLocalString()[/font]; it's [font=monospace]Date.toString()[/font]. And JavaScript will call it as necessary. (See http://developer.netscape.com/docs/manuals/js/client/jsref/date.htm.) But you will not like the resulting string so you might want to overwrite the method to your liking. If you just want the date:[/font]

[font=monospace]

<script type="text/javascript">

<!--

Date.prototype.toString = function () {return [['Sunday,', 'Monday,', 'Tuesday,', 'Wednesday,', 'Thursday,', 'Friday,', 'Saturday,'] [this.getDay()], this.getDate(), ['January', 'February', 'March', 'April', 'May', 'June', ,'July', 'August', 'September', 'October', 'November', 'December'] [this.getMonth()], this.getFullYear()].join('&nbsp;')}

document.write('<h6>', new Date(), '</h6>')

// -->

</script>[/font]
Copy linkTweet thisAlerts:
@CharlesApr 27.2003 — [font=georgia]The really sad thing is that I double checked the documentation and ran your example on a few different browsers. I must have been having a very bad morning.[/font]
Copy linkTweet thisAlerts:
@CharlesApr 27.2003 — [font=georgia]I think that I was having another bad morning. Thanks for catching my mistake. This, by the way, is why I refuse to offer back channel help.[/font]
×

Success!

Help @Kobushi_no_Kami 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...