Library code snippets

Display the Current Day of the Week

Demonstrates how to display the current day of the week.

<script language="javascript">
var DayOfWeek;
function fncDayOfWeek()
{
var stDate;
var now;
var assoc= new Array(7);
assoc[0]="Sunday";
assoc[1]="Monday";
assoc[2]="Tuesday";
assoc[3]="Wednesday";
assoc[4]="Thursday";
assoc[5]="Friday";
assoc[6]="Saturday";
now= new Date();
stDate=now.getDay();
return(assoc[stDate]);
}

document.write('<B>Current Day of the Week:</b>' + DayOfWeek);

</script>

Comments

  1. 10 Oct 2008 at 12:15
    document.write('Current Day of the week :'+fncDayOfWeek() );
  2. 10 Oct 2008 at 12:13
    just replace the last sentence of the above code ie document.write with the following code.. document.write('Current Day of the Week:' + fncDayOfWeek() );
  3. 27 Jun 2007 at 18:44
    I've implemented this code and it reads:

    Current Day of the Week: undefined

    Any way to fix this?

    -- May







  4. 01 Jan 1999 at 00:00

    This thread is for discussions of Display the Current Day of the Week.

Leave a comment

Sign in or Join us (it's free).

David Nishimoto NishiSoft provides Part I of the Information Technology Project collaboration. Sign up and list your IT project tasks, assign task too friends, and get percent complete task. Part will include a wo...

Related podcasts

  • jQuery in ASP.NET

    In this episode Chris Brandsma, Rick Strahl, Dave Ward, Bertrand Le Roy, Scott Koon, and Steven Harman discuss Microsoft's jQuery in ASP.NET announcement.This episode of the Alt.NET Podcast is brought to you by LLBLGen Pro, the most mature O/R mapper and code generator out there.Are you loo...

Events coming up

  • Dec 8

    December Silicon Valley Ruby Meetup

    Moffett Field, United States

    In a World of Middleware, Who Needs Monolithic Applications? by Jon Crosby With Rack emerging as the standard for composing web applications and services, most recently with Rails adoption, an architectural shift is taking place. Learn how to create next generation web services by reusing existing Rack middleware and supplementing with your own components and micro-frameworks like Sinatra. Bio : Jon likes music, the Open Web, Ruby, Erlang, Haskell, Objective-C, JavaScript and coffee.

Want to stay in touch with what's going on? Follow us on twitter!