How can I remove the time with the date on a datePicker on sql server c #. Example ddMMYYY 00:00:00
How can I remove the time with the date on a datePicker on sql server c #. Example ddMMYYY 00:00:00
Try to use Format function:
SELECT FORMAT(GETDATE(), 'ddMMyyyy');
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.
If you never need the time, then use a date column instead of datetime in SQL.
I have on the table date problem this in the part of receiving data.
cmd.Parameters.Add("@duoDate", SqlDbType.Date).Value = DateNac.SelectedDate.Value.Date;
the problem i s here : pettable.DuoDate = reader.GetDateTime(1);
the problem is: when displaying the data in the recovery I get the date and time I want to remove the time when displaying the data.
Maybe you should execute 'pettable.DuoDate = reader.GetDateTime(1).Date'?
I have it : pettable.DuoDate = reader.GetDataTime(1).Date;
but when displaying the data I get the date (which is chosen in the DataaPicker) and the time
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.
19 people are following this question.