PDA

View Full Version : [VB] calcolare "ora fine" avendo ora inizio e durata


Stigmata
26-04-2010, 16:48
ciao a tutti
ho un db access con una tabella che contiene una serie di eventi, per ciascun elemento ho un campo per l'ora di inizio in formato "hh.mm.ss" e un campo per la durata espressa in minuti

es: 13.24.37 | 245

voglio estrarre tutti gli eventi che TERMINANO alle 23.59.59, come posso fare?

grazie, ciao :)

Darecon
26-04-2010, 17:48
Usa la funzione DateAdd() per sommare il tempo all'ora che hai.. ;)

MarcoGG
26-04-2010, 18:51
ciao a tutti
ho un db access con una tabella che contiene una serie di eventi, per ciascun elemento ho un campo per l'ora di inizio in formato "hh.mm.ss" e un campo per la durata espressa in minuti

es: 13.24.37 | 245

voglio estrarre tutti gli eventi che TERMINANO alle 23.59.59, come posso fare?

grazie, ciao :)

Se il senso è "che terminano entro le 23.59.59" :
Dim data1 As New DateTime(2010, 4, 26, 13, 24, 37)
Dim durata As Integer = 245
Dim data2 As New DateTime(2010, 4, 26, 23, 59, 59)
If DateAndTime.DateAdd(DateInterval.Minute, durata, data1) <= data2 Then
MsgBox("ok")
Else
MsgBox("l'evento sfora")
End If

Poi prova con durata = 636 e vedrai che sfora... ;)

Hardware Upgrade Forum Database Error
Database Error Database error
The Hardware Upgrade Forum database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.hwupgrade.it home page, then try to open another page.
  • Click the Back button to try another link.
The www.hwupgrade.it forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.