Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a date in UTC format like "Mon Feb 12 22:07:13 UTC +0530 2007" and I have to display it into normal date format like "1st Jan 2010" in javascript? Can anyone suggest solutions?
Posted
Updated 17-Sep-12 21:18pm
v3

You better format it on server side (see. http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^]), but it depends how you process your data on client side, and how you get your date data from the server.
 
Share this answer
 
Hi DivyaJ,
U can use following Jquery code.
$.format.date("2009-12-18 10:54:50.546", "dd-MM-yyyy");


Hope it will work for you.....
 
Share this answer
 
Here is a simple javascript solution to give you an idea,

JavaScript
var d = new Date("Mon Feb 12 22:07:13 UTC +0530 2007");
var n = ''+d.getUTCDate()+' '+d.getUTCMonth()+' '+d.getUTCFullYear()+'';


Output: 12 2 2007

You can add Jan/Feb and suffix 'st' etc as you prefer.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900