new Date() dispalys invalid date


Here is my code:

$(document).ready(function () {
    $(".submit-text").click(function () {

         var startdate = $("#startdate").val(); /*This line returns mm/dd/yyyy */
         var starttime = $("#starttime").val(); /*This line retruns hr:min AM/PM */

         var dtstart =  new Date("startdate" + starttime);

****On alert it displays invalid date...         

but if I use..  

var dtstart =  new Date("02/14/2013 " + starttime);

It alerts proper result...I am not getting what is wrong with this...need help

Thanx in advance


I got it...
In new Date() we can only pass string and not variable..
d =startdate + " " + starttime;
var dtstart = new Date(d);


Question Self-Answered as of 2 Years Ago
This question has already been solved: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: