Home > Code > Javascript > Generic method to get today’s date using JavaScript

Generic method to get today’s date using JavaScript

by Narain Siddharth   on Dec 12, 2011   Category: Javascript   |  Views: 1007    |  Points: 25   |  Silver 


Below generic JavaScript sample code use to return the current date


<script type="text/javascript">

function GetTodayDate()
{
var dtToday = new Date();
var Crrntday = format(dtToday.getDate());
var Crrntmonth = format(dtToday.getMonth() + 1);
var Crrntyear = format(dtToday.getFullYear());
return Crrntday + "-" + Crrntmonth + "-" + Crrntyear;
}

</script>




Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts