Forum Moderators: open
What I'm trying to do is to somehow parse a date/time stamp that looks like this "2008-02-02 10:28:17", and to create a variable that calculates how long ago that was.
How would I even start with inserting a timestamp into my function.
In my loop statment time[i].innerHTML="2008-02-02 10:28:17";
Can I go like this?
var now=new Date();
var old=new Date();
old.setTime(time[i].innerHTML);
var current=now-old;
Thanks
gives time difference ms.
[msdn2.microsoft.com...]
[edited by: daveVk at 12:33 am (utc) on Feb. 3, 2008]
That tid bit helped me a lot! And it moved me to find Date.parse().
I was able to create all of the script, but I have one small bug.
Anyone have an idea how I can strip off the date ending without affecting a month like August?
This will work, except for months with August in them.
time="February 3rd 2008, 9:47".replace(/st¦nd¦rd¦th/,"");
Any ideas would be much appreciated.