|
-
Feb 10th, 2003, 08:50 AM
#1
Thread Starter
Lively Member
Display Date Without the Time
I am trying to display the date from SQL server database into a window form textbox as "dd/MM/yyyy", but it shows the time also.
Any idea how to avoide this.
Thanks for the help
<><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><>
-
Feb 10th, 2003, 09:21 AM
#2
Lively Member
use the formatdatetime() or the format()
for example
textbox1.text = formatdatetime(dteDateandTime, DateFormat.ShortDate)
or
textbox1.text = format(dteDateandTime, "MM/dd/yyyy")
-
Feb 10th, 2003, 09:36 AM
#3
Thread Starter
Lively Member
Databinding removes the format !!
Me.txtRegDate.DataBindings.Add("Text", myDS.Tables("Member"), "RegDate")
<><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><>
-
Feb 10th, 2003, 10:26 AM
#4
Lively Member
in cases like this, i have traditionally modified my sql statement to return a string representation of the date i want to look at. the problem with this approach, however, is if you try to sort by that column, its sorted by the string, not the date. i have been looking for a way around this, but still havent found one. sorry.
-
Feb 10th, 2003, 10:37 AM
#5
Thread Starter
Lively Member
<><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><>
-
Feb 10th, 2003, 02:05 PM
#6
Thread Starter
Lively Member
dwhawley,
This solves the problem perfectly, look at the Format and Parse events.
http://msdn.microsoft.com/library/de...ormattopic.asp
Originally posted by dwhawley
in cases like this, i have traditionally modified my sql statement to return a string representation of the date i want to look at. the problem with this approach, however, is if you try to sort by that column, its sorted by the string, not the date. i have been looking for a way around this, but still havent found one. sorry.
<><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><>
-
Feb 10th, 2003, 03:48 PM
#7
Lively Member
nice find and thanks for the return message. my issue has been formatting values within a datagrid and it appears that this is how you do it
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|