Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date formats
Message
From
11/10/2006 09:36:34
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
01161162
Message ID:
01161172
Views:
11
Hi Pete,

I'm assuming you get 11-10-20 instead of 11-10-2006 because you've set the textbox to only be 8 characters. You're going to have to parse it out yourself I think. Simple code (I'd create a method to handle this):
DateTime now = DateTime.Now;
string day   = now.Day.ToString();
string month = now.Month.ToString();
string year  = now.Year.ToString();
year = year.Substring(2);
mytextbox.Text = day + "-" + month + "-" + year;
Will that work for you?

~~Bonnie



>Hello All, I would like to be able to show dates in the format: dd-mm-yy without setting the Windows shortdate to dd-mm-yy ( I'm using a masked textbox for input ), however, if I populate the Text property using
>
>mytextbox.Text = DateTime.Now.ToShortDateString();
>
>I get 11-10-20, I don't know the implications of changing the Windows shortdate setting so would like to work around it for now, many thanks.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform