Link to home
Start Free TrialLog in
Avatar of WingYip
WingYip

asked on

format date in text box control

I have a form with an underlying dataset (from a sql server db) that is bound to various textboxes.  A couple of the fields in the dataset contain dates.  Is there a way to format the dates in the text boxes.

Currently they display as ‘06/10/2003 00:00:00’

I need them to display as 06/10/2003.

Is this possible?
Avatar of ob2
ob2

Easy Peasy

1) TextBox.Text = String.Format("{0:d}", Date)

Where d is always lowercase for short date and where date is the date from your dataset.
ASKER CERTIFIED SOLUTION
Avatar of the-edge
the-edge

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Learned
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: ob2 {http:#9763177} & the-edge {http:#9763248}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
Avatar of WingYip

ASKER

Have just tested the code.

the-edge gets the points

Thanks

Wing