Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,971 questions

51,913 answers

573 users

How to convert string to DateTime in VB.NET

4 Answers

0 votes
Imports System

Class Program

    Public Shared Sub Main(ByVal args As String())
        Dim s As String = "9-19-2018"
        
        Dim dt As Date = Convert.ToDateTime(s)
 
        Console.WriteLine(dt)    
    End Sub
End Class




' run:
'
' 9/19/2018 12:00:00 AM
'

 



answered Sep 19, 2018 by avibootz
edited Apr 8, 2024 by avibootz
0 votes
Imports System

Class Program

    Public Shared Sub Main(ByVal args As String())
        Dim s As String = "9-19-2018 20:10:31"
        
        Dim dt As Date = Convert.ToDateTime(s)
 
        Console.WriteLine(dt)    
    End Sub
End Class




' run:
'
' 9/19/2018 8:10:31 PM
'

 



answered Sep 19, 2018 by avibootz
edited Apr 8, 2024 by avibootz
0 votes
Imports System

Class Program

    Public Shared Sub Main(ByVal args As String())
        Dim s As String = "11/14/2021"
         
        Dim dt As DateTime = Convert.ToDateTime(s)
         
        Console.WriteLine(dt)
    End Sub
End Class




' run:
'
' 11/14/2021 12:00:00 AM
'

 



answered Apr 8, 2024 by avibootz
0 votes
Imports System

Class Program

    Public Shared Sub Main(ByVal args As String())
        Dim s As String = "11/14/2021 09:25 AM"
         
        Dim dt As DateTime = Convert.ToDateTime(s)
         
        Console.WriteLine(dt)
    End Sub
End Class




' run:
'
' 11/14/2021 9:25:00 AM
'

 



answered Apr 8, 2024 by avibootz

Related questions

...