javascript文字列を日付に変換する[js常用]

531 ワード

function strToDate(){
      var nowDate = new Date();     
      var oldDate = '2009-06-08';
      var oldTime = '16:00';
      var year = oldDate.substr(0,4);
      var month = oldDate.substr(5,2);
      var day = oldDate.substr(8,2);
      var temDate = month+'/'+day+'/'+year+' '+oldTime+":00";
      alert(temDate);
      //       
      alert(new Date(Date.parse(temDate))>nowDate);
}