Solved

Formating Date

Posted on 2004-04-23
2
193 Views
Last Modified: 2010-04-24
I have following queery

SELECT DISTINCT Week_ending
FROM         Timesheets
WHERE     (EmployeeID = '1') AND (tsheet_date BETWEEN '2004-01-01' AND '2004-12-31 23:59')

which results in a 3/28/2004 12:00:00 result set when I bind it to listbox...

        ds = New DataSet

        myda.Fill(ds, "AllTables")

        ListBox3.DataSource = ds
        ListBox3.DataSource = ds.Tables(0)
        ListBox3.DataTextField = ds.Tables(0).Columns("Week_ending").ColumnName.ToString()
        ListBox3.DataValueField = ds.Tables(0).Columns("Week_ending").ColumnName.ToString()
        ListBox3.DataBind()
        ListBox3.Items.Insert(0, "All")

I need the result set to be just 3/28/2004, thanks
0
Comment
Question by:gtvingo14
2 Comments
 
LVL 48

Accepted Solution

by:
Mikal613 earned 100 total points
Comment Utility


SELECT DISTINCT convert(varchar(10),Week_ending,110)
FROM         Timesheets
WHERE     (EmployeeID = '1') AND (tsheet_date BETWEEN '2004-01-01' AND '2004-12-31 23:59')
0
 
LVL 1

Expert Comment

by:warmach
Comment Utility
If the date being returned is being held in a DateTime typed variable, use the method ToShortDateString()

DateTime d;

d.ToShortDateString();
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now