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 8431341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:49:44+00:00 2026-06-10T05:49:44+00:00

I have a JSON object which returns a list of events with dates and

  • 0

I have a JSON object which returns a list of events with dates and times, I want to add a counter to the next event time, but i am not sure how to approach this?

Basically, my JSON is like:

[{"name": "BAKER-CROSSROADS", "country": "USA", "lon": "165.25", "yield": "21", "lat": "11.58", "depth": ".027", "date": "1946/07/24 21:35:00", "id": "1"}, {"name": "VENUS", "country": "USA", "lon": "-116.2", "yield": "10", "lat": "37.19", "depth": ".03", "date": "1958/02/22 01:00:00", "id": "10", "fill": "green"}, {"name": "HATCHIE", "country": "USA", "lon": "-116.03", "yield": "20", "lat": "37.058", "depth": ".061", "date": "1963/02/08 16:00:01", "id": "100", "fill": "green"}, {"name": "CLIMAX:Upshot-Knothole", "country": "USA", "lon": "-116.0183", "yield": "61", "lat": "37.0875", "depth": "-.41", "date": "1953/06/04 11:14:57", "id": "1000", "fill": "red"}, {"name": "BRAVO:Castle", "country": "USA", "lon": "165.274", "yield": "15000", "lat": "11.698", "depth": "0", "date": "1954/02/28 18:45:00", "id": "1001", "fill": "red"}, ....

so for each object:

{“name”: “BAKER-CROSSROADS”, “country”: “USA”, “lon”: “165.25”, “yield”: “21”, “lat”: “11.58”, “depth”: “.027”, “date”: “1946/07/24 21:35:00”, “id”: “1”}

{“name”: “VENUS”, “country”: “USA”, “lon”: “-116.2”, “yield”: “10”, “lat”: “37.19”, “depth”: “.03”, “date”: “1958/02/22 01:00:00”, “id”: “10”, “fill”: “green”}

…

here is the code that reads the json file:

    this.loadNext = function () {
    d3.json("./data/detonations.json", function(datum) {
        for(var i = datum.length - 1; i >= 0; --i) {
            var o = datum[i];
            //console.log(o);
            message = {
                country: o.country
                ,date: o.date
                ,depth: o.depth
                ,lon: o.lon
                ,lat: o.lat
                ,type: o.type
                ,yield: o.yield
            };
            self.doSomething(message)
        }
    });
}

i would like to calculate the date/time difference, so in this case the difference of “1958/02/22 01:00:00” and “1946/07/24 21:35:00” and pass this to the message array?

  • 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-06-10T05:49:45+00:00Added an answer on June 10, 2026 at 5:49 am

    To have this difference in millisecondes, you may use

    var diff = (new Date(s2)).getTime() - (new Date(s1)).getTime();
    

    That’s because the format you have is directly parsable by the Date class.

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

Sidebar

Related Questions

I have simple resource which should return JSON array, but it returns object in
I have a web service which returns a list of JSON Objects...such as below:
I have a JSON object which is generated by PHP. It's an object with
I have created an empty json object having an array itemlist(which further contains itemid
I have a form field which requires a json object as its value when
I have a working JavaScript code below which dynamically creates JSON object using JSON.parse
I have several TextField columns on my UserProfile object which contain JSON objects. I've
I have an controller that returns JSON. It takes a form, which validates itself
I have an AngularJS app that returns a list of json objects and I
I have an action which returns JSON to a jQuery datatable . The data

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.