Current location: Hot Scripts Forums » General Web Coding » JavaScript » todays date script


todays date script

Reply
  #1 (permalink)  
Old 05-31-06, 04:17 AM
vannquish vannquish is offline
Newbie Coder
 
Join Date: Oct 2005
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
todays date script

Ive used the search facillity but I just keep getting scripts on calenders.

All I need is a simple script to display the current date on my front page.

does anyone know where I can get this from.

thank you
Reply With Quote
  #2 (permalink)  
Old 05-31-06, 10:09 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
<script>
document.write(new Date())
</script>
More info about the Date object on MSDN.com/library.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #3 (permalink)  
Old 06-03-06, 04:59 AM
fourbaht fourbaht is offline
Newbie Coder
 
Join Date: May 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
if you want domething that is a bit more flexible in the out put try this..

Code:
<SCRIPT LANGUAGE="JavaScript">


DaysofWeek = new Array()
DaysofWeek[0]="Sunday"
DaysofWeek[1]="Monday"
DaysofWeek[2]="Tuesday"
DaysofWeek[3]="Wednesday"
DaysofWeek[4]="Thursday"
DaysofWeek[5]="Friday"
DaysofWeek[6]="Saturday"

Months = new Array()
Months[0]="January"
Months[1]="February"
Months[2]="March"
Months[3]="April"
Months[4]="May"
Months[5]="June"
Months[6]="July"
Months[7]="August"
Months[8]="September"
Months[9]="October"
Months[10]="November"
Months[11]="December"

RightNow = new Date()
var

hours = RightNow.getHours();
if (hours >= 12) {
hours = (hours == 12) ? 12 : hours - 12; mm = " pm";
}
else {
hours = (hours == 0) ? 12 : hours; mm = " am";
}

var day = DaysofWeek[RightNow.getDay()]
var date = RightNow.getDate()
var Month = Months[RightNow.getMonth()]
var Year = RightNow.getFullYear()
var Minutes = RightNow.getMinutes()
var Hours = RightNow.getHours()


if (date == 1 || date == 21 || date == 31)
{ender = "<SUP>st</SUP>"}

else
if (date == 2 || date == 22)
{ender = "<SUP>nd</SUP>"}

else
if (date == 3 || date == 23)
{ender = "<SUP>rd</SUP>"}

else
{ender = "<SUP>th</SUP>"}

document.write(day+ ", "+Month+  " " +date+", " +Year+ ", "+Hours+":" +Minutes+mm)
</SCRIPT>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Raffle/Lottery Script (Very profitable!), Coded it myself. Voltaire General Advertisements 6 03-16-09 07:15 AM
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
Raffle/Lottery Script (Very profitable!), Coded it myself. Voltaire General Advertisements 2 01-02-06 11:55 PM
Need date calculation Script - NOT A TYPICAL SCRIPT UplinkUSA Everything Java 0 02-16-05 09:49 AM


All times are GMT -5. The time now is 11:10 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.