Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

JSON - How to format a Date String

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
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)

856 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