How can I remove the time with the date of the database in the data retrieval

Javier R 211 Reputation points
2021-05-06T20:20:40.657+00:00

How can I remove the time with the date on a datePicker on sql server c #. Example ddMMYYY 00:00:00

Universal Windows Platform (UWP)
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,894 questions
0 comments No comments
{count} votes

5 additional answers

Sort by: Newest
  1. AryaDing-MSFT 2,916 Reputation points
    2021-05-07T08:01:10.18+00:00

    Hi,

    Welcome to Microsoft Q&A!

    I don’t understand your meaning well. You means that you have inserted an value that seleced through DatePicker(UWP control) into SQL database, and now you want to remove the value from database, right? If yes, please refer to the following code.

    using (var cmd = connection.CreateCommand())  
        {  
            connection.Open();  
            cmd.CommandText = "delete from tableName where columnName = @date";  
            cmd.Parameters.AddWithValue("@date", date);  
            cmd.ExecuteNonQuery();  
        }  
    

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Viorel 112.9K Reputation points
    2021-05-07T07:29:10.847+00:00

    If you never need the time, then use a date column instead of datetime in SQL.


  3. Olaf Helper 41,411 Reputation points
    2021-05-07T05:37:27.04+00:00

    on a datePicker on sql server

    There is not DatePicker or any other control on SQL Server side.

    Use DateTime.Date Property to get the date without time potion.

    0 comments No comments

  4. Yitzhak Khabinsky 25,201 Reputation points
    2021-05-06T21:44:44.31+00:00

    Another way is via CASTing:

     SELECT CAST(GETDATE() AS DATE);
    
    0 comments No comments