I want to convert a time string say '12:05 PM' into a 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 pass in values of 1:00 PM, 1:05 PM, 1:10 PM, 12:00 AM,...,12:00 PM it works fine
returning me a Date with the time included.
This is the code line causing an issue:
var startTime = Date.parse($("#<%= StartTime.ClientID %>").val()); //code causing the issue
And StartTime
is a textbox.
I am writing the above code in client/html in an ASP.NET application on the web form.