Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET jQuery
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 21:45pm
Dhivyaj345
Edited 17-Sep-12 22: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
0 Sergey Alexandrovich Kryukov 450
1 OriginalGriff 230
2 DamithSL 150
3 Dave Kreskowiak 110
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,740
1 DamithSL 5,644
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,011
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2014
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