From: http://amix.dk/blog/viewEntry/19360
function addToDate ( date , hours , minutes ) {
var m_secs = date . getTime ();
var local_offset = date . getTimezoneOffset () * 60 * 1000 ;
var utc_m_secs = m_secs + local_offset ;
if ( hours )
utc_m_secs += hours * 60 * 60 * 1000 ;
if ( minutes )
utc_m_secs += minutes * 60 * 1000 ;
return new Date ( utc_m_secs );
}
Example: var four_hours_ago = addToDate ( new Date () , -4 );
file: /Techref/inet/iis/jscript/htm/addToDate.htm,
0KB, , updated: 2008年11月3日 18:41, local time: 2025年9月8日 04:42,
©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Questions?<A HREF="http://massmind.org/techref/inet/iis/jscript/htm/addToDate.htm"> jscript, javascript, function addtodate</A>
Did you find what you needed?
Welcome to massmind.org!
Welcome to massmind.org!
.