Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date format 1

Status
Not open for further replies.

shaminda

Programmer
Jun 9, 2000
170
US
I want to format a date say 7/9/2004 to 070904(a string). How do I do this in .net. In VB 6.0 it is pretty straight forward. But in VB.Net I haven’t had any luck. Here is what I tried:

Dim sDate As String
sDate = Format(Now, "mmddyy")
 
Dim d As DateTime
Dim str As String

d = DateTime.Now
str = d.ToString("MMddyy")

ToString is overloaded to accept an output format.

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top