how can we extract system time in vb and do calculation ie. adding or subtracing time then store change time in oracle database table in earlier format .
+4
A:
To get the system time
Dim timestamp As Date: timestamp = Now
timestamp = timestamp - Int(timestamp)
To add or subtract a time interval (e.g. add one hour)
timestamp = DateAdd("h", 1, timestamp)
To store it in a database, something like
Dim cnn As New Connection
cnn.ConnectionString = "YourConnectionString"
Dim cmd As New Command
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "YourStoredProcName"
cmd.ActiveConnection = cnn
Dim prm As Parameter: Set prm = cmd.CreateParameter("YourParameterName", adDBTime, adParamInput)
prm.Value = timestamp
Call cmd.Parameters.Append(prm)
Call cnn.Open
Call cmd.Execute
Call cnn.Close
AdamRalph
2010-03-31 16:40:47
@AdamRalph: how about decrementing time ? DateSub() not working ...
banita
2010-03-31 17:09:30
fine by taking negative value its working thanks .
banita
2010-03-31 17:11:48
you're welcome. if you feel I've answered your question, don't forget to accept my answer by clicking the large tick mark
AdamRalph
2010-04-01 07:49:24