Created
March 21, 2015 03:20
-
-
Save jeanlucaslima/63d76aadf209be747135 to your computer and use it in GitHub Desktop.
MySQL date to JavaScript
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
// Divide a string em [ Y, M, D, h, m, s ] | |
var t = "2015-03-21 03:12:01".split(/[- :]/); | |
// Aplica os itens em uma nova variável, já no padrão de data JavaScript | |
var d = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment