Solved

JSON - How to format a Date String

Posted on 2013-01-02
5
380 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Print Rhino Java Array in Javascript 1 39
Link Anchor Not working 9 49
make control visible based off other control value 7 22
modify change color of text 9 37
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

733 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