Click here to Skip to main content
13,086,662 members (56,579 online)
Rate this:
 
Please Sign up or sign in to vote.
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 17-Sep-12 20:45pm
Dhivyaj345
Updated 17-Sep-12 21:18pm
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.....
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Here is a simple javascript solution to give you an idea,

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.
  Permalink  
v3

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100