- Public Function DateDBToPage(ByVal pDate As String) As String
- ' Composition d'une date de base de donnée style AAAAMMJJ vers JJ/MM/AAAA
- If pDate.Length = 8 Then
- Return Mid(pDate, 7, 2) + "/" + Mid(pDate, 5, 2) + "/" + Mid(pDate, 1, 4)
- Else
- Return ""
- End If
- End Function
-
- Public Function HeureDBToPage(ByVal pHeure As String) As String
- ' Composition d'une Heure de base de donnée style HHMM vers HH:MM
- If pHeure.Length = 4 Then
- Return Mid(pHeure, 1, 2) + ":" + Mid(pHeure, 3, 2)
- Else
- Return ""
- End If
- End Function
-
-
- ' -------------------------------------------------------------------------------
- Public Function DatePageToDb(ByVal pDate As String) As String
- ' -------------------------------------------------------------------------------
- ' Composition d'une date JJ/MM/AAAA pour une base de donnée style AAAAMMJJ
- If pDate.Length >= 8 Then
- Dim x1 As Integer = pDate.IndexOf("/") + 1 ' Récup position du premier "/"
- Dim x2 As Integer = pDate.IndexOf("/", x1 + 1) + 1 ' Récup position du deuxième "/"
- Dim aaaa, mm, jj As String
-
- aaaa = Mid(pDate, x2 + 1, pDate.Length - x2)
- If aaaa.Length = 2 Then aaaa = "20" + aaaa ' On vérifie si une date sur 2 position on complète avec 20xx
- aaaa = aaaa.PadLeft(4, "0")
- mm = Mid(pDate, x1 + 1, x2 - x1 - 1).PadLeft(2, "0")
- jj = Mid(pDate, 1, x1 - 1).PadLeft(2, "0")
-
- Return aaaa + mm + jj
- Else
- Return ""
- End If
-
- End Function
-
- ' -------------------------------------------------------------------------------
- Public Function HeurePageToDb(ByVal pHeure As String) As String
- ' -------------------------------------------------------------------------------
- ' Composition d'une heure HH:MM pour une base de donnée style HHMM
- If pHeure.Length >= 3 Then
- Dim x1 As Integer = pHeure.IndexOf(":") + 1 ' Récup position du ":"
- Dim x2 As Integer = pHeure.Length
- Dim hh, mm As String
-
- If x1 < 0 Then
- ' Il n'y à pas de ':' dans l'heure on la justifie comme ca sur 4 positions
- hh = Format(Int(pHeure), "0000")
- Return hh
- Else
- mm = Mid(pHeure, x1 + 1, x2 - x1).PadLeft(2, "0")
- hh = Mid(pHeure, 1, x1 - 1).PadLeft(2, "0")
- End If
-
- Return hh + mm
- Else
- Return "0000"
- End If
- End Function
Public Function DateDBToPage(ByVal pDate As String) As String
' Composition d'une date de base de donnée style AAAAMMJJ vers JJ/MM/AAAA
If pDate.Length = 8 Then
Return Mid(pDate, 7, 2) + "/" + Mid(pDate, 5, 2) + "/" + Mid(pDate, 1, 4)
Else
Return ""
End If
End Function
Public Function HeureDBToPage(ByVal pHeure As String) As String
' Composition d'une Heure de base de donnée style HHMM vers HH:MM
If pHeure.Length = 4 Then
Return Mid(pHeure, 1, 2) + ":" + Mid(pHeure, 3, 2)
Else
Return ""
End If
End Function
' -------------------------------------------------------------------------------
Public Function DatePageToDb(ByVal pDate As String) As String
' -------------------------------------------------------------------------------
' Composition d'une date JJ/MM/AAAA pour une base de donnée style AAAAMMJJ
If pDate.Length >= 8 Then
Dim x1 As Integer = pDate.IndexOf("/") + 1 ' Récup position du premier "/"
Dim x2 As Integer = pDate.IndexOf("/", x1 + 1) + 1 ' Récup position du deuxième "/"
Dim aaaa, mm, jj As String
aaaa = Mid(pDate, x2 + 1, pDate.Length - x2)
If aaaa.Length = 2 Then aaaa = "20" + aaaa ' On vérifie si une date sur 2 position on complète avec 20xx
aaaa = aaaa.PadLeft(4, "0")
mm = Mid(pDate, x1 + 1, x2 - x1 - 1).PadLeft(2, "0")
jj = Mid(pDate, 1, x1 - 1).PadLeft(2, "0")
Return aaaa + mm + jj
Else
Return ""
End If
End Function
' -------------------------------------------------------------------------------
Public Function HeurePageToDb(ByVal pHeure As String) As String
' -------------------------------------------------------------------------------
' Composition d'une heure HH:MM pour une base de donnée style HHMM
If pHeure.Length >= 3 Then
Dim x1 As Integer = pHeure.IndexOf(":") + 1 ' Récup position du ":"
Dim x2 As Integer = pHeure.Length
Dim hh, mm As String
If x1 < 0 Then
' Il n'y à pas de ':' dans l'heure on la justifie comme ca sur 4 positions
hh = Format(Int(pHeure), "0000")
Return hh
Else
mm = Mid(pHeure, x1 + 1, x2 - x1).PadLeft(2, "0")
hh = Mid(pHeure, 1, x1 - 1).PadLeft(2, "0")
End If
Return hh + mm
Else
Return "0000"
End If
End Function