Edit in JSFiddle

function convert(){
    var inputDate=document.getElementById('inDate').value;
    var inputFormat=document.getElementById('inFormat').value;    
    var date=getDateFromFormat(inputDate, inputFormat);
    if(date !==0 && inputFormat!==''){
    var dateString = (new Date(date)).toString();
            alert(dateString);
    }
    else
    {
     alert('Format and Date string are mis-match');   
    }
}
    <p><H2>Convert date string to date object using specific format</H2></p>
   Date String: <input type='text' id='inDate' value=''/><br><br>    
   Date Format <input type='text' value='' id='inFormat'/><br><br> 
    <input type='button' onClick="convert()" value='Convert'/>   

    <br><br> 
        <iframe id="iframe1" src="http://jqfaq.com/AdPage.html" style="width:100%;border:none;"></iframe>

              
            
          
            
              

External resources loaded into this fiddle: