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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Format

Status
Not open for further replies.

jessiejane

Programmer
Oct 29, 2009
32
US
I am pretty new to VB.NET.

I need to print the current date whatever the date is in the format of MMDDYY? The Date should not be hard coded and should take whatever the current date is.

For Example if today date is 11/5/2009 it should print in 110509 (MMDDYY)

Any help is really appreciated.
 
I have to get the previous date in MMDDYY format.

I am trying this but getting output as 11DDYY. Not able to figure out why i am getting the value instead 0f 112309
-------------------------------
Dim strModDate as date
Dim strTodayDate as string

strModDate = DateTime.Today.AddDays(-1)
Console.WriteLine(strModDate)
strTodayDate = strModDate.ToString("MMDDYY")
Console.WriteLine(strTodayDate)

Output from code:11DDYY
Desired Output: 112309

-------------------------------------

Any help is appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top