Home > Javascript > Get Date with Javascript

Get Date with Javascript


try this Example to Display Date using Javascript

<html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>">
<head id="Head1" runat="server">
    <title>Untitled Page</title>

    <script language="javascript" type="text/javascript">
        var datetime=new Date();
        var d=datetime.getDate();
        var day=datetime.getDay();
        var month=datetime.getMonth();
        var year=datetime.getYear();
        if (year < 1000)       
        var days=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
        var months=new Array("January","February","March","April","May","June","July","August","September","Octomber","November","December");

    <form id="form1" runat="server">

            <script language="JavaScript" type="text/javascript">
                alert((days[day]+", "+months[month]+" "+d+" "+year));

Hope this helps

Good Luck

Categories: Javascript
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: