function StringToDate(sDate)
{
// Parameters :
// sDate : A string with the format "mm/dd/yyyy" or "mm/dd/yyyy hh:mm:ss"
// Returns : a Date object
if (sDate =="")
{
sDate="01/01/2040";
}
var ArDateTime = sDate.split (" ");
var ArDate = ArDateTime[0];
var splitDate = ArDate.split ("/");
var nDay = ToNumber(splitDate[1]);
var nMonth = ToNumber(splitDate[0]);
var nYear = ToNumber(splitDate[2]);
if (ArDateTime.length == 1)
return (new Date(nYear, nMonth-1 , nDay))
else
{ var ArTime = ArDateTime[1];
var splitTime = ArTime.split(":");
if (splitTime[0]=="00" && splitTime[1]=="00" && splitTime[2]=="00" )
return (new Date(nYear, nMonth-1 , nDay))
else
{
var nHours = ToNumber(splitTime[0]);
var nMinutes = ToNumber(splitTime[1]);
var nSeconds = ToNumber(splitTime[2]);
return (new Date(nYear,nMonth-1,nDay, nHours, nMinutes, nSeconds))
}
}
}