Thursday, March 12, 2009

javascript to find day difference.

HTML START
HEAD START HERE
SCRIPT START HERE language="javascript" type="text/javascript"
today = new Date();
todayEpoch = today.getTime();

target = new Date("1 Jan, 2009");
targetEpoch = target.getTime();

daysLeft = Math.floor(((targetEpoch - todayEpoch) / (60*60*24)) / 1000);
SCRIPT END HERE

HEAD END
BODY START HERE
FROM START method="get" action="http://www.google.com/search"

DoD inspection in

SCRIPT START HERE document.write(daysLeft); SCRIPT TAG END HERE

days. Are you ready?

FORM END
BODY END
HTML END

No comments:

Post a Comment