Skip to content

Instantly share code, notes, and snippets.

@moluapple
Created June 23, 2011 09:47
Show Gist options
  • Save moluapple/1042262 to your computer and use it in GitHub Desktop.
Save moluapple/1042262 to your computer and use it in GitHub Desktop.
Change System Time
/***************************
* 修改Windows系统时间
* 用于运行超过时限无法运行的js
***************************/
var d = new Date();
var today ='date ' + [d.getFullYear(), d.getMonth()+1, d.getDate()].join('-');
function changeDate(date, del){
var filerf = new File ('setDate.bat');
var flag = filerf.open ('w');
filerf.write(date);
filerf.close();
filerf.execute();
$.sleep(500);
if (del) filerf.remove();
}
changeDate('date 2010-5-1', 0);
/*do some thing here...e.g.
eval('@JSXBIN@ES@1.0@...');
*/
changeDate(today, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment