Hi,
I need to create a valid date time from a string in order to use the created date as a parameter in a database request; My string is in the British date time format '18/03/2014 08:57' and I have attempted to convert this into a usable parameter with the following code but I get an invalid date exception. How do I do this correctly?
var sStr = ('18/03/2014 08:57').split(' ');
var timeStr=(sStr[1] + '.000');
var datePart = sStr[0].split('/');
var dayStr = datePart[0];
var mthStr= datePart[1];
var yearStr = datePart[2];
var utcDate = yearStr + '-' + mthStr + '-' + ' ' + dayStr + timeStr;
var D = new Date(utcDate);
console.log(D);