Reputation: 31
I am using .NET compact Framework, more precisely using Windows mobile 6.0 and was trying to convert a string to datetime but seems it is not supported. Any help would be appreciated.
Dim provider AS CultureInfo = New CultureInfo("en-US")
Dim dt AS DateTime = Convert.ToDatetime("5/2/2013 5:15:03 PM")
Getting a formatexception issue.
Upvotes: 0
Views: 270
Reputation: 8592
Please see the following .NET Fiddle here.
Imports System
Imports System.Globalization
Public Module Module1
Public Sub Main()
Dim provider AS CultureInfo = New CultureInfo("en-US")
Dim dt AS DateTime = Convert.ToDatetime("5/2/2013 5:15:03 PM")
Console.WriteLine(dt)
Console.WriteLine(dt.ToString("d",provider))
End Sub
End Module
Output:
Upvotes: 0