How to convert a Date to a formatted string in VB.NET

2 Answers

0 votes
Module Module1

    Sub Main()

        Dim dt As Date = New Date(2018, 9, 19)
        Dim s As String = dt.ToString("yyyy-MM-dd HH:mm:ss")

        Console.WriteLine(s)

    End Sub

End Module

' run:
' 
' 2018-09-19 00:00:00

 



answered Sep 19, 2018 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim dt As Date = New Date(2018, 9, 19)
        Dim s As String = dt.ToString("yyyy-MM-dd")

        Console.WriteLine(s)

    End Sub

End Module

' run:
' 
' 2018-09-19

 



answered Sep 19, 2018 by avibootz

Related questions

1 answer 159 views
1 answer 181 views
1 answer 104 views
2 answers 212 views
212 views asked Nov 15, 2021 by avibootz
1 answer 129 views
1 answer 211 views
...