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

  • SEARCH
  • Home
  • 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 4544276
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:38:56+00:00 2026-05-21T15:38:56+00:00

How can I convert a date time format from JSON.Net such as: /Date(1154970000000+0700)/ To

  • 0

How can I convert a date time format from JSON.Net such as:

/Date(1154970000000+0700)/

To ISO-?? format
2011-12-18T23:34:59Z

Preferably in either Python or Javascript.

Ive decided on the latter as its seems in the JS world the most widely used, humanly readable and naturally sortable. I’ll store offsets on a per user basis.

If an implementation is again a bit much too ask, if someone can tell me the correct name for both formats I might have more luck in understanding how to convert.

  • 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-21T15:38:57+00:00Added an answer on May 21, 2026 at 3:38 pm
    jsonDate = "/Date(1154970000000+0700)/";
    
    var strDate = parseInt(jsonDate.replace(/\/Date\(([-\d]+).*$/, "$1"));
    var strHour = parseInt(jsonDate.replace(/.*\d([+-]\d\d).*$/, "$1"), 10);
    var strMin = parseInt(jsonDate.replace(/.*\d([+-])\d\d(\d\d).*$/, "$1$2"), 10);
    
    var date = new Date(strDate);
    if (!isNaN(strHour)) date.setHours(date.getHours() + strHour);
    if (!isNaN(strMin)) date.setMinutes(date.getMinutes() + strMin);
    
    var out = date.toISOString();
    

    And the function to convert to ISO:

    var toISOString = Date.prototype.toISOString ?
        function(d){return d}:
        (function(){
            function t(i){return i<10?"0"+i:i};
            function h(i){return i.length<2?"00"+i:i.length<3?"0"+i:3<i.length?Math.round(i/Math.pow(10,i.length-3)):i};
            function toISOString(){
                return "".concat(
                    this.getUTCFullYear(), "-",
                    t(this.getUTCMonth() + 1), "-",
                    t(this.getUTCDate()), "T",
                    t(this.getUTCHours()), ":",
                    t(this.getUTCMinutes()), ":",
                    t(this.getUTCSeconds()), ".",
                    h("" + this.getUTCMilliseconds()), "Z"
                );
            };
            return function(d){
                d.toISOString = toISOString;
                return d;
            }
        })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I convert the time from the format Thu Jun 09 2011 00:00:00
To convert a date from string to Unix time, I can use date --date
i fetched from created field date and time like this format 2011-3-10 17:26:50 and
How can I convert a date time string of the form Feb 25 2010,
How can I convert a string to a date time object in javascript by
Can anyone suggest an easy method to convert date and time to different timezones
How can I convert an Excel date (in a number format) to a proper
I have a Date/Time they come from a Apache server in this format :
I have a requirement to convert a date from a local time stamp to
How can I convert my date field from mysql from 2010-10-24 09:02:46 to post

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.