﻿       
function IsTimeValid(s) {
    var iDay, iMonth, iYear,iHour,iMinute,iSecond;
    var arrValues;

    arrValues = s.split(" ");
    arr1 = arrValues[0].split("-");
    arr2 = arrValues[1].split(":");
    
    
    iYear = arr1[0];
    iMonth = arr1[1];
    iDay = arr1[2];

    iHour = arr2[0];
    iMinute = arr2[1];
    iSecond = arr2[2];


    var testDate = new Date(iYear, iMonth - 1, iDay,iHour,iMinute,iSecond);
    if ((testDate.getDate() != iDay) ||
      (testDate.getMonth() != iMonth - 1) ||
      (testDate.getFullYear() != iYear) ||
      (testDate.getHours() != iHour) ||
      (testDate.getMinutes() != iMinute) ||
      (testDate.getSeconds() != iSecond)) {
        return false;
      
    }

    return true;
}

