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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:11:42+00:00 2026-06-07T11:11:42+00:00

Possible Duplicate: How do I output an ISO-8601 formatted string in Javascript? I have

  • 0

Possible Duplicate:
How do I output an ISO-8601 formatted string in Javascript?

I have a date like

Thu Jul 12 2012 01:20:46 GMT+0530

How can I convert it into ISO-8601 format like this

2012-07-12T01:20:46Z
  • 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-07T11:11:43+00:00Added an answer on June 7, 2026 at 11:11 am

    In most newer browsers you have .toISOString() method, but in IE8 or older you can use the following (taken from json2.js by Douglas Crockford):

    // Override only if native toISOString is not defined
    if (!Date.prototype.toISOString) {
        // Here we rely on JSON serialization for dates because it matches 
        // the ISO standard. However, we check if JSON serializer is present 
        // on a page and define our own .toJSON method only if necessary
        if (!Date.prototype.toJSON) {
            Date.prototype.toJSON = function (key) {
                function f(n) {
                    // Format integers to have at least two digits.
                    return n < 10 ? '0' + n : n;
                }
    
                return this.getUTCFullYear()   + '-' +
                    f(this.getUTCMonth() + 1) + '-' +
                    f(this.getUTCDate())      + 'T' +
                    f(this.getUTCHours())     + ':' +
                    f(this.getUTCMinutes())   + ':' +
                    f(this.getUTCSeconds())   + 'Z';
            };
        }
    
        Date.prototype.toISOString = Date.prototype.toJSON;
    }
    

    Now you can safely call `.toISOString() method.

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

Sidebar

Related Questions

Possible Duplicate: Python: Date Ordinal Output? In Python time.strftime can produce output like Thursday
Possible Duplicate: Command prompt output being read as empty string I have a command
Possible Duplicate: Running a command from Ruby displaying and capturing the output I have
Possible Duplicate: How to replace string in SQLite? I have a table column data
Possible Duplicate: Emitting unencoded strings in a Razor view I have a string that
Possible Duplicate: sql to pick apart a string of a persons name and output
Possible Duplicate: C# String output: format or concat? what is the benefit of using
Possible Duplicate: Output of command in Bash script to Drop-down box? I have an
Possible Duplicate: Converting an ISO 8601 timestamp into an NSDate: How does one deal
Possible Duplicate: Floating point comparison I have some simple C code and the output

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.