Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

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.
0
jrossi2000
Asked:
jrossi2000
1 Solution
 
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
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
GivenRandyCommented:
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now