1

How to have the output of my JSON Date value as follows in JQuery? '11/25/2011 10:43:45 AM'

5
  • Datetime format of SQL Server Commented Nov 25, 2011 at 18:46
  • Which is ....... and what language are you using to get from SQL to the browser ? there are lots of ways to skin a cat Commented Nov 25, 2011 at 18:46
  • There is no inbuilt method in jQuery to change the format of a date - but there are in SQL / MySQL / PHP / .NET / Java ... ie they are more suited to change the format of a date .... (im not saying it cant be done in JavaScript) Commented Nov 25, 2011 at 18:48
  • like Date.Now in Asp.net and I want to format it like '11/25/2011 10:43:45 AM' Commented Nov 25, 2011 at 18:49
  • I dont use SQL server and i dont use Asp.net - just please update your question with the format of the date you want to translate !!! Commented Nov 25, 2011 at 18:50

2 Answers 2

2

You could try datejs - http://www.datejs.com/

You can see a full list of the formats it provides here - http://code.google.com/p/datejs/wiki/FormatSpecifiers

Sign up to request clarification or add additional context in comments.

1 Comment

I will, I like to use the client side resources than the server side, but for now I didn't want to use external JS in my project and use the server side formatting instead.
1

If you are not using the date as a date type, but for display I tend to just get the date into the string format I like on JSON source and pass it to the client like that, ie: rather than let the date be serialized into '/Date(1224043200000)/' I pass DateTime.Now.ToString().

If you can't do that How to Format a JSON date might help?

1 Comment

Date.Now.ToString("MM/dd/yyyy h:mm tt")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.