Created
January 20, 2016 15:11
-
-
Save cyper85/4c7e40e1e3ac2336e6d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var datum = new Date("2014-07-11T12:00Z"); | |
console.log(datum.toGMTString()); | |
// Ausgabe: Invalid Date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var datumString = "2014-07-11T12:00Z"; | |
var datum = new Date(datumString); | |
if(datum.toGMTString() == "Invalid Date") { | |
// Ich arbeite wie gesagt nur mit GMT, daher ist das entfernen der Zeitzone einfach: | |
var zwischenDatum = new Date(datumString.replace(/[T]/g," ").replace(/[Z]/g,"")); | |
datum.setTime(Date.parse(datumString.replace(/[T]/g," ").replace(/[Z]/g,""))-(zwischenDatum.getTimezoneOffset()*60*1000)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://blog.stadtplan-ilmenau.de/2014/07/date-probleme-mit-dolphin/