Changing System Clock within a Window

Is it possible, with Visual Basic, to change the system clock just for a given window?  i.e. without affecting other windows.
jrossi2000Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
GivenRandyConnect With a Mentor Commented:
No.  As others have confirmed, by inference.  You can use a different time to act as a "new" clock, or you can use an offset from the "real" system clock.
0
 
GivenRandyCommented:
No.
0
 
GivenRandyCommented:
The system clock applies to the system.  However, you can use a timer within your program and have it go off every second.  You can adjust that to be whatever you want.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Erick37Commented:
You can use the system time to calculate a new relative time for your application.  Using DateAdd() to convert NY time to LA time:

Private Sub Timer1_Timer()
    Debug.Print DateAdd("h", -3, Time)
End Sub
0
 
prameshCommented:
You can change the system clock using Win32Api functions. You have to write code to change system clock. Set your choice for that particular window and then reset it for other windws. Remember, it will effect to the whole operating system.
or
use DATEADD function in vb to add dates etc. In this it won't effect other windows.
0
 
VoodoomanCommented:
Hi

You can change the time really easy by just using the time function

time="10:10:00" sets the time on your PC to 10 past.

Get the time when you load the form

'Form Level variables
'********************
Dim mytime,timediff

mytime=now

'now change the time
time="12:12"

'get your change
'***************
timediff=mytime-now


when you close the form recalculate the date and time


mytime=now+timediff

'now reset date and time
'***********************
date=format(mytime,"Short Date")
time=format(mytime,"hh:mm:ss")



This should do it

Dont just use just the time in case you roll over midnight - using just the time will cause problems

Voodooman!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.