Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Acceder a la fecha en la que una foto fue tomada en VB .NET (See related posts)

//Función a la que se le pasa el archivo jpg o jpge y devuelve la fecha en la que fue tomada

    Public Function ObtieneFecha(ByVal RutaArchivo As String) As Date

        Dim image As New Bitmap(RutaArchivo)
        Dim propItems As System.Drawing.Imaging.PropertyItem() = image.PropertyItems

        Dim encoding As New System.Text.ASCIIEncoding

        For i As Integer = propItems.GetLowerBound(0) To propItems.GetUpperBound(0)
            If propItems(i).Id.ToString = "36868" Then
                Dim strAux1() As String = Split(encoding.GetString(propItems(i).Value), " ")
                Dim strAux2() As String = Split(strAux1(0), ":")
                Dim strAux3() As String = Split(strAux1(1), ":")
                Return CDate(strAux2(0) & "/" & strAux2(1) & "/" & strAux2(2) & " " & strAux3(0) & ":" & strAux3(1) & ":" & strAux3(2))
            End If
        Next
        image.Dispose()
    End Function

You need to create an account or log in to post comments to this site.


Click here to browse all 4861 code snippets

Related Posts