Get the time from a date string

date, javascript, time

Solution

Just create new Date object:

var myDate = new Date("2013-04-08T10:28:43Z");

var minutes = myDate.getMinutes();
var hours = myDate.getHours();

Problem

How do I get the time from the date string using JavaScript. My datestring is in the following way: 2013-04-08T10:28:43Z How to split the time in hours and minutes format. I want to show the activity stream in the following way: xxx has updated 2hrs ago yyy has updated 3min ago

Original source

Related problems