Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4260394
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:54:50+00:00 2026-05-21T05:54:50+00:00

If I have a JSON DateTime: DateCreated:\/Date(1301692095627)\/ How can I format that into a

  • 0

If I have a JSON DateTime:

"DateCreated":"\/Date(1301692095627)\/"

How can I format that into a 12 hour time using jQuery?

Right now I’m using this:

function DateDeserialize(dateStr) {
    return eval('new' + dateStr.replace(/\//g, ' '));
}

Which outputs the JSON object as:

Fri Apr 01 2011 17:08:15 GMT-0400 (Eastern Daylight Time)

But I would like to get just the time, in 12 hour format.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:54:51+00:00Added an answer on May 21, 2026 at 5:54 am

    Use the .getHours() method on the date object (which returns 0-23). Check to see if it’s over 12 hours, if so, subtract 12 hours otherwise it’s already fine.

    see this jsFiddle: http://jsfiddle.net/s2hyL/1/

    var hrs = new Date().getHours();
    
    var hrs12 = hrs > 12 ? hrs - 12 : hrs;
    

    If you need to perform formatting (or complex parsing), I highly recommend the date.js library by Matt Kruse.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSON array with ActiveRecord objects. These objects can be reconstructed using
I have one JSON that is coming in a string format. I need to
I have a JSON result that contains numerous records. I'd like to show the
Hi I have a JSON object that is a 2-dimentional array and I need
I see that JSON.NET has a DateTime converter: string javascriptJson = JsonConvert.DeserializeObject(entry, new JavaScriptDateTimeConverter());
I have a C# application that serializes its DTOs to JSON and sends them
I have this block of code that eventually get serialized to JSON, for use
I have a JSON as follows { columns : [RULE_ID,COUNTRY_CODE], RULE_ID : [1,2,3,7,9,101,102,103,104,105,106,4,5,100,30], COUNTRY_CODE
I have two JSON objects with the same structure and I want to concat
Do Pagemethods and Json have security risks?(I dont use cookies).Forexample i have a pagemethod

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.