Here i will show a simple way for how to format the date in jquery.Basically all of know the date format can only be done in sql server .But We have number of jquery methods to performs on date objects.In the below script i will get the current date into variable Current date,then it will format into desirable Date format.we can see The which date format has passed to varibale "Dateformat" in below script
The above script gives output like "27-03-2012 07:28:21"
var Currentdate = getDate(); var Dateformat = 'dd-MM-yyyy hh:mm:ss'; var DesirableDate = $.format.date(Currentdate, Dateformat);
The above script gives output like "27-03-2012 07:28:21"
No comments:
Post a Comment