Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change the OS Date/Time

Status
Not open for further replies.

stevepuri

Programmer
Mar 30, 2001
24
0
0
US
Does anyone know how to change the OS Date/Time using VBScript or JavaScript ?

Thanks,
Steve
 
To actually change it? Can't be done.

To get it and manipulate it yes... use the Date object. I hope this helped! ;-)
- Casey Winans
 
Think about the security issues involved with that. It would be very bad to have those capabilities. I hope this helped! ;-)
- Casey Winans
 
Here's a way you can do it:

<script language=&quot;javascript&quot;>
<!--

function change_system_date(new_date)
{
var this_date;
var dt=new Date();

while ((this_date=(dt.getMonth() + 1) + &quot;/&quot; + dt.getDate() + &quot;/&quot; + dt.getYear())!=new_date) {
alert(&quot;Please change your system date to &quot; +
new_date +
&quot; and then press Ok&quot;);
dt=new Date();
}
}

//-->
</script>

Usage: change_system_date(&quot;5/5/2001&quot;);

Russ
bobbitts@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top