I want to convert the time string say '12: 05 PM 'to datetime using Date.Parse in javascript. When I pass in a value of, say, 12:05 PM or 12:10 PM or ... or 12:55 PM, the value returned by startTime below is null, i.e. startTime = null
But when I go to 1:00 PM, 1:05 PM, 1:10 PM, 12:00 AM, ..., 12:00 PM it works fine
returning me the date with the included time.
This is the line of code causing the problem:
var startTime = Date.parse($("#<%= StartTime.ClientID %>").val());
And StartTime is a text box.
I am writing the above code in client / html in an ASP.NET application in a web form.
source share