Reputation: 7201
I want to display my date like so in VB.NET
2008/01/22 14:23:15
How is this done in code?
This does not give me enough: lblDate.Text = Today.Date
Upvotes: 1
Views: 26847
Reputation: 51711
Try
lblDate.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
Upvotes: 9
Reputation: 128327
This should display the way you want:
Dim formattedDate As String = Date.Today.ToString("yyyy/MM/dd HH:mm:ss")
And see Custom DateTime Format Strings for a complete reference.
Upvotes: 9