c# - Conversion of date time in jQuery -


i have ajax request date time database. example, date time 3/24/2014 10:15:35 am, , want show date time razor view page. code ::

view code ::

 $.ajax({         url: "/home/checklatestticket",         type: "post",         success: function (data) {             var date = date(data);                           $("#latestticket").html("<p style='font-size: 15px;'>" + date + "</p>");         }     }); 

controller ajax request:

    public actionresult checklatestticket()     {         datetime result = (from t in db.imsticket t.viewticketclient == 0 && t.organizationid == 1 orderby t.createticket descending select t.createticket ).firstordefault();          return json(result);     } 

using code current date time following format::

this actual result ajax request

   /date(1395634535793)/ 

this result, showed in page: (which current date time)

mon mar 24 2014 17:50:26 gmt+0600 (bangladesh standard time) 

i want show result

    3/24/2014 10:15:35  

i think should try client-side conversion can other information ajax request. can follow code:

$.ajax({    url: "/home/checklatestticket",    type: "post",    success: function (data) {       var thisdate = new date(parseint(data.substr(6)));           $("#latestticket").html("<p style='font-size: 15px;'>" + thisdate.tolocalestring() + "</p>");    } }); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -