Friday, October 7, 2011

String to Date in VB.NET

Here is a simple sample to parse from string to date and then to an specific format like yyyyMMdd,
which could be handy for file naming.

 Dim strDate As String = dateExpiration.Text
 Dim parsedDate As Date

 parsedDate = DateTime.Parse(strDate)
 txtMsg.Text = parsedDate.ToString("yyyyMMdd")

No comments:

Post a Comment