hi :)
how to adjust system date and time using
vb..
For this i have developed a function..
Actually i need to reduce the minute by 1 when i use this function.. When i reduce the minute it was reducing correctly.. but when minute is in 0 means at that time i need to reduce the hour also..
for example current time is 03:22:23
it was reduced correctly as 03:21:23
but
when the time is in 03:00:02 means it need to be reduced as 02:59:02..
It was reading correctly but when it sets the time problem arises for this situation..
coding is given below..
Dim mm1 As Integer
Dim dd As String
Dim hh As Integer
Dim ss As Integer
Dim yy As String
Dim mo As String
Dim ww As String
Dim hour1 As Integer
Private Type SystemTime
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
lpSystemTime As Long
End Type
Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SystemTime) As Long
Private Sub Form_Load()
time1 = Now
If (minute(Time) > 0) Then
mm1 = minute(Time) - 1
ElseIf (hour(Time) > 0) Then
hour1 = hour(Time) - 1
mm1 = 59
End If
dd = Day(Date)
ss = Second(Time)
yy = Year(Date)
mo = Month(Date)
ww = Weekday(Date, vbUseSystemDayOfWeek)
Dim lpSystemTime As SystemTime
lpSystemTime.wYear = yy
lpSystemTime.wMonth = mo
lpSystemTime.wDayOfWeek = ww
lpSystemTime.wDay = dd
lpSystemTime.wHour = hour1
lpSystemTime.wMinute = mm1
lpSystemTime.wSecond = ss
lpSystemTime.wMilliseconds = 0
'set the new time
SetSystemTime lpSystemTime
End Sub
PLEASE help me