• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2605
  • Last Modified:

VB.Net convert from ToShortDateString to MM/DD/YY in a text box (string)

I have a series of column headers that currently are textbox to display date ranges.
 
I have this close to what I want, but would like to trim down 2006 to 06.

Currently displays:
7/18/2006

Would like:
7/18/06

Current code is:

txtDate1.Text = Date.Today.ToShortDateString

Tried format on the end and played around with it but couldn't get this.  Do I need to create a Date Variable, do the formatting, then send to string and set the text box value to this or can I do directly within string like I'm attempting?

Thanks,
Jon

0
JMO9966
Asked:
JMO9966
1 Solution
 
Ravi SinghSenior Software EngineerCommented:
You could use the ToString method and specify a format in the actual parameter:

txtDate1.Text = Date.Today.ToString("MM/dd/yy")
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now