Solved

JSON - How to format a Date String

Posted on 2013-01-02
5
377 Views
Last Modified: 2013-01-04
Hi.
I have web service that returns a value like

/Date(1357142400000)/

How can I format like  'Jan 2  11:00 AM'

When I tried using the Date()  it returns

"Wed Jan 02 21:46:20 2013"    Which can't be correct.
0
Comment
Question by:JElster
5 Comments
 
LVL 15

Assisted Solution

by:Minh Võ Công
Minh Võ Công earned 166 total points
ID: 38738914
0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 167 total points
ID: 38738950
0
 
LVL 1

Author Comment

by:JElster
ID: 38739773
Hi..
I still don't see how to do it.
0
 
LVL 9

Accepted Solution

by:
Sar1973 earned 167 total points
ID: 38743319
This function:
function myDateConverter() {
var myDate = new Date(1357142400000);
var myGMTDate=myDate.toUTCString();
}

Open in new window

will output "Wed, 2 Jan 2013 16:00:00 UTC".
0
 
LVL 9

Expert Comment

by:Sar1973
ID: 38743369
Use then one or more between these functions and the JS string functions to create a customised date string.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now