Home > DeveloperSection > Forums > find the day name and month name from current date
Somesh

Total Post:21

Points:147
Posted on    October-11-2011 3:08 AM

 JavaScript JavaScript 
Ratings:


 1 Reply(s)
 1680  View(s)
Rate this:
hi,
How to find the day name and month name from current date ?

thanks


Amit Singh

Total Post:103

Points:721
Posted on    October-11-2011 8:57 PM

Hi somesh,
we find the month name and day from current date by using built in function in javascript. check this example

<script type="text/javascript">
    var monthNames=new Array("January","February","March","April","May","June","July","August",
"September","October","November","December");
  
 var dayNames=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Wednesday","Thursday","Friday",
"Saturday");
   
var InputDate=new Date();
   
var strDays=dayNames[InputDate.getDay()];  
 var strMonth=monthNames[InputDate.getMonth()];   
var strYear=InputDate.getYear()+1900;
  
 alert(strDays+", "+strMonth+", "+strYear);
    </script>

Modified On Oct-11-2011 08:59:50 PM

Don't want to miss updates? Please click the below button!

Follow MindStick