Reputation: 11
I have a quastion. So I get from server a variable with date-time string which looks like this: '31/08/2015 13:24'. How can extract from this string separately date and time?
Upvotes: 0
Views: 32
Reputation: 21759
You could split the string:
var dateTime = '31/08/2015 13:24'.split(" "); console.log(dateTime[0]); //date console.log(dateTime[1]); //time
Or use js Date object to get the day, month, year, hours, etc:
var dateTime = new Date('31/08/2015 13:24');
Upvotes: 1