Q:

Convert from String to DateTime in Node Js

I have a variable called workFrom that has time(hh:mm) as String at the FrontEnd(Angular JS).  I would like to convert this to Date format before posting the data on to MongoDB with default date as 01/01/1970 and the time from whatever has been posted from workFrom.  How do I do it? 
Eg : workFrom : 11:40 should be converted to 01/01/1970 11:40 (according to the standard format of date used in MongoDB). 
Thanks in advance 

A:

Solution in vanila JS. 

var input = '11:40';
var parts = input.split(':');
var minutes = parts[0]*60 +parts[1];
var inputDate = new Date(minutes * 60 * 1000);
console.log(inputDate);

Or use moment as wrote abhishekkannojia.