Public Function ED(Ngay)
' Dim orgStart As Byte
Dim i As Integer
Dim Ngay1 As String
Ngay = Ngay & "__________"
For i = 1 To Len(Ngay)
Select Case Mid$(Ngay, i, 1)
Case "_", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
Ngay1 = Ngay1 & Mid(Ngay, i, 1)
End Select
If Len(Ngay1) = 8 Then Exit For
Next
ED = Mid$(Ngay1, 1, 2) & "/" & Mid$(Ngay1, 3, 2) & "/" & Mid$(Ngay1, 5, 4)
''
orgStartHT = InStr(1, ED, "_")
If orgStartHT = 0 Then orgStartHT = 11
If orgStartHT > InStr(1, ED, "/_") And orgStartHT < 8 Then
orgStartHT = orgStartHT - 1
End If
End Function