asp.net mvc - How do I format Date/Time with jQuery Templates? -


i've started using jquery templates javascript template engine. question is, how can format date (returned asp.net json actionresult) in form:

/date(1288709830000)/ 

i tried doing following:

{{= $.format(new date(parseint(comment.datecreated.substr(6))), 'd')}}  

note above uses new jquery globalization plugin add $.format method. note {{= comment.datecreated }} long hand saying ${comment.datecreated}.

i'd appreciate if help.

this used

var formatdate = function (datetime) {     var dateobj = new date(parseint(datetime.replace("/date(", "").replace(")/", ""), 10));     return dateobj.format("dd-mmm-yyyy"); //01-jun-2001 } 

and in jquery template

${formatdate(inceptiondate)}


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -