does anyone know how to subtract a certain number of days from a given date?
thanks in advance for your help.
Nevermind I figured it out with the help of the help index.
I know nothing about vb.net (sure sounds like i can help :rolleyes: )
but maybe this will work
Public Function TimeDiff(LesserTime As String, LesserTimeDate As String, GreaterTime As String, GreaterTimeDate As String) As String Dim Thrs As Single, Tmins As Single, Tsecs As Single, ReturnTime As String Dim DTcheck As Single DTcheck = DateDiff("d", LesserTimeDate, GreaterTimeDate) If DTcheck > 0 Then For i = 0 To DTcheck Hour(GreaterTime) = Hour(GreaterTime) + 24 Next ElseIf DTcheck < 0 Then TimeDiff = "ERROR" Exit Function End If Thrs = Hour(GreaterTime) - Hour(LesserTime) If Thrs > 0 Then Tmins = Minute(GreaterTime) - Minute(LesserTime) If Tmins < 0 Then Tmins = Tmins + 60 Thrs = Thrs - 1 End If ElseIf Thrs = 0 And Minute(GreaterTime) > Minute(LesserTime) Then Tmins = Minute(GreaterTime) - Minute(LesserTime) Else TimeDiff = "ERROR" Exit Function End If Tsecs = Second(GreaterTime) - Second(LesserTime) If Tsecs < 0 Then Tsecs = Tsecs + 60 If Tmins > 0 Then Tmins = Tmins - 1 Else Tmins = 59 End If TimeDiff = TimeSerial(Thrs, Tmins, Tsecs) End Function
It's not a big issue to subtract date from given days.You can use the "Subtract" function in ASP.NET.
TextBox1.Text = DateTime.Now.AddDays(-3)
Here is a routine to add 24 hours to the current date/time. Maybe it will help.
Dim futureTime As TimeSpan = ExecTime - Now
'if the calculated time has already passed,
'add 24 hours so it does it tomorrow
If waitTime.Hours < 0 Then
Dim myTimeSpan As New TimeSpan(24, 0, 0)
futureTime = futureTime .Add(myTimeSpan)
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.
This is the result of previous question answered :
code for the listbox - datagridview interaction
At the top of the code ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...