Created
October 23, 2015 08:07
-
-
Save Artem-Schander/2ec9268e40b96a936932 to your computer and use it in GitHub Desktop.
Parse Date - Plain JS
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 date = new Date('2015-10-21 15:54:44'); | |
var day = date.getDate(); | |
var month = date.getMonth() + 1; | |
var year = date.getFullYear(); | |
var hours = date.getHours(); | |
var minutes = date.getMinutes(); | |
var dateString = ('0' + day).slice(-2) + '.' + ('0' + month).slice(-2) + '.' + year + ' - ' + ('0' + hours).slice(-2) + ':' + ('0' + minutes).slice(-2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment