Reputation: 3736
I have a database table that stores a datetime value.
I want to display that value on my asp.net textboxes, except I need to show date value in TextBox A and Time in TextBox B.
How can I split those values in VB.NET?
Upvotes: 1
Views: 2929
Reputation: 11263
You can use the built in date formatting functions in VB:
Dim ThisDate as DateTime = Now
Dim TimePart as string = ThisDate.ToShortTimeString
dim DatePart as string = ThisDate.ToShortDateString
Upvotes: 0
Reputation: 62484
The idea is to use format string:
dateTimeReadedFromDb.ToString("dd-MM-yyyy")
dateTimeReadedFromDb.ToString("hh:mm:ss")
Upvotes: 4