Skip to content

Instantly share code, notes, and snippets.

@Artem-Schander
Created October 23, 2015 08:07
Show Gist options
  • Save Artem-Schander/2ec9268e40b96a936932 to your computer and use it in GitHub Desktop.
Save Artem-Schander/2ec9268e40b96a936932 to your computer and use it in GitHub Desktop.
Parse Date - Plain JS
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