I have a date input in yyyy-mm-dd format and I cannot convert it to a proper JavaScript date. The example below yields February 1, 2008 when it should be January 1, 2008. Can someone point out the error of my ways?
Thanks
a newbie
<script language="JavaScript" type="text/javascript">
function ConvertDate()
{
var dt_input = "2008-01-01";
var input_year = dt_input.substring(0,4);
var input_month = dt_input.substring(5,7);
var input_day = dt_input.substring(8,10);
var date_input = new Date(input_year, input_month, input_day);
alert(date_input);
}
</script>