mario.deghetto

Visual Basic & .NET
posts - 332, comments - 79, trackbacks - 0

#10 Convertire una data dal formato “yyyymmdd” a DateTime

Questo semplice codice permette di convertire una data dal formato “yyyymmdd” (ad es. “20081102″) e trasformarla in un’istanza di DateTime:

Private Function ToDateTime(ByVal dataYyyyMmDd _
            As String) As DateTime
    Dim myCultureInfo As _
        New System.Globalization.CultureInfo("it-IT", True)
    Dim formato As String = "yyyyMMdd"
    Return System.DateTime.ParseExact(dataYyyyMmDd, _
        formato, myCultureInfo)
End Function

Print | posted on mercoledì 14 ottobre 2009 4.45 |

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 6 and 5 and type the answer here:

Powered by: