Dreamcasting Dreamcasting - 1 year ago 127
jQuery Question

Convert JSON.NET date to jQuery UI Datepicker format

I am serializing and passing a date out of my controller using

and sending it to a jQuery UI Datepicker field. Right now the output is like
and I want it to be in a format of
. My output is available via the AJAX returned data object
and is being attached to
but always shows as 12/31/1969.

I've tried moment (and failed) using this code:

var BoardStart = data.BoardStart;

Any suggestions? Thanks!

Answer Source

Using the moment.js library for formatting date, substitute



moment(BoardStart, "YYYY-MM-DDhh:mm:ss").format("MM/DD/YYYY")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download