You must Sign In to post a response.
  • Category: .NET

    DateTime in SQL Server and Date in ASP.NET (C#)

    The forum thread has not been reviewed by Editors yet. Readers are advised to use their best judgement before accessing this thread.
    This thread will be reviewed shortly.
    If you think this thread contain inappropriate content, please report to webmaster.
    Dear All

    I had a record in SQL Server which contains a datatime field (e.g. with value 9/6/2006 17:04:35)

    I created a aspx to capute the use input date and then use date to search this record. If user input 9/6/2006, there is no record found. However, if user input exactly the date and time 9/6/2006 17:04:35, record is found.

    So the question is: I would like to only use the 9/6/2006 instead of using the datetime value for search this record(s). What can I do in this case?

  • #58170
    use this
    SELECT *
    FROM Tb_LoggInUser
    WHERE CONVERT(CHAR(10), CreatedDate, 101) = '06/12/2006'

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.