Solved

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

Posted on 2006-07-18
1
2,212 Views
Last Modified: 2008-02-01
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
Comment
Question by:JMO9966
1 Comment
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 125 total points
ID: 17135028
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question