Let's say I have an initial date equal to 30/01/2014 10:00
and an end date equal to 02/02/2014 10:00
.
I wonder if it's possible to get a grid containing these results:
If possible, I would like to know how.
Let's say I have an initial date equal to 30/01/2014 10:00
and an end date equal to 02/02/2014 10:00
.
I wonder if it's possible to get a grid containing these results:
If possible, I would like to know how.
Use the DateDiff () function. For example:
Dim diffDatas as Integer
diffDatas = DateDiff("d", #30/01/2012#, #31/01/2014#)
The first parameter represents the measure you want to calculate the difference, if in days, if in months, years, minutes, etc. The second parameter contains the start date and the third end date.
You can choose the second intervals:
yyyy - Ano
q - trimestre (quarter)
m - Mes
y - Dia do ano
d - Dia
w - Dia da semana
ww - Semana
h - Hora
s - Segundos
The following is the function reference on the MSDN website: ( link )
Hello
I use it that way
Dim Data_1 As Date = FormatDateTime(DtpData_Inicio.Value)
Dim Data_2 As Date = FormatDateTime(DtpData_Fim.Value)
'Aqui, um txt traz o resultado em número decimal
TextBox1.Text += (DateDiff(DateInterval.Day, DtpData_Inicio, DtpData_Fim).ToString)
I hope I have helped