In VB (6.0 or earlier) the Date and Time statements allow you to change the system date/time. Here's an example using date.
Dim dOldDate As Date
'Store the date
dOldDate = Date
'Set the date backward to 2004
Date = CDate(';1/1/2004';)
'Set it back to what it was
Date = dOldDateHow to change or edit system time and restore it again in the current time by coding in VB?
just right click then hit adjust date/timeHow to change or edit system time and restore it again in the current time by coding in VB?
use the now function to save the date and use the date statment to reset it.
e.g.
Sub changeDate(newDate As Date)
Dim currentDate As Date
' save the current date
currentDate = Now()
' set the system date
Date = newDate
' restore the system date
Date = currentDate
End Sub
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment