//Función a la que se le pasa el archivo jpg o jpge y devuelve la fecha en la que fue tomada
1
2 Public Function ObtieneFecha(ByVal RutaArchivo As String) As Date
3
4 Dim image As New Bitmap(RutaArchivo)
5 Dim propItems As System.Drawing.Imaging.PropertyItem() = image.PropertyItems
6
7 Dim encoding As New System.Text.ASCIIEncoding
8
9 For i As Integer = propItems.GetLowerBound(0) To propItems.GetUpperBound(0)
10 If propItems(i).Id.ToString = "36868" Then
11 Dim strAux1() As String = Split(encoding.GetString(propItems(i).Value), " ")
12 Dim strAux2() As String = Split(strAux1(0), ":")
13 Dim strAux3() As String = Split(strAux1(1), ":")
14 Return CDate(strAux2(0) & "/" & strAux2(1) & "/" & strAux2(2) & " " & strAux3(0) & ":" & strAux3(1) & ":" & strAux3(2))
15 End If
16 Next
17 image.Dispose()
18 End Function