Dim fs As DateTime = Convert.ToDateTime("2018-08-10").Date
Dim fh As DateTime = Convert.ToDateTime("2018-05-14").Date
If fs > fh Then
MessageBox("ok")
End If
Public Function compareDate(ByVal fechaInicial As String, ByVal fechaActual As String) As Integer
Dim result As Integer = 0
Dim dif As TimeSpan = Convert.ToDateTime(fechaActual) - Convert.ToDateTime(fechaInicial)
Dim nDays As Integer = dif.Days
If nDays = 0 Then
result = 0
'MessageBox.Show("Es el mismo día")
ElseIf nDays > 0 Then
result = 1
'MessageBox.Show("La fecha actual es mayor")
ElseIf nDays < 0 Then
result = -1
'MessageBox.Show("La fecha inicial es mayor")
End If
Return result
End Function
No hay comentarios.:
Publicar un comentario