In the code below date information is store in the variable cVal.
I separate the date from the time (perhaps not really needed).
Then I use regExp to replace - and : with a comma and space.
Then I combine date and time again in cDate.
My problem is this cDate is a string variable with " " around it. each value needs to be a number not alpahnumeric. As a result I get invalid date.
How do I turn these into numbers?
-
var cDate = cVal.slice(0, cVal.indexOf("T") );
-
var cTime = cVal.slice( cVal.indexOf("T")+1, cVal.indexOf("Z") );
-
cDate = cDate.replace( /-/g, ", ");
-
cTime = cTime.replace( /:/g, ", ");
-
cDate += ", "+cTime
-
-
var dt = new Date( cDate );
-
-
cTime = getLocalTimeFromGMT(dt)
-
-
-
function getLocalTimeFromGMT(sTime){
-
var dte = new Date(sTime);
-
dte.setTime(dte.getTime()
-
- dte.getTimezoneOffset()*60*1000);
-
// document.write(dte.toLocaleString());
-
}
-
-