The following code:
Expand|Select|Wrap|Line Numbers
- Dim str As New StringBuilder
- Dim x As String = "11/6/2009 14:00"
- Dim dx As Date
- Date.TryParse(x, dx)
- str.Append("dx:")
- str.Append(Environment.NewLine)
- str.Append(dx.Date.ToString)
- str.Append(Environment.NewLine)
- str.Append(dx.ToString("M/d/yyyy h:mm tt"))
- str.Append(Environment.NewLine)
- str.Append(dx.Hour.ToString.PadLeft(2, "0"))
- str.Append(":")
- str.Append(dx.Minute.ToString.PadLeft(2, "0"))
- str.Append(":")
- str.Append(dx.Second.ToString.PadLeft(2, "0"))
- str.Append(Environment.NewLine)
- str.Append(Environment.NewLine)
- MessageBox.Show(str.ToString)
11/6/2009 12:00 AMWhat's weird about this is that the Date toString method is incorrect unless provided some sort of format for the time.................
11/6/2009 2:00 PM
14:00:00
-Frinny