I have the following code that passes the date that is in the MySQL database to the textblock:
textBlock8.Text = (reader.GetString("Data"));
What happens is that it is passing the date and time. I would like to spend only the date.
I have the following code that passes the date that is in the MySQL database to the textblock:
textBlock8.Text = (reader.GetString("Data"));
What happens is that it is passing the date and time. I would like to spend only the date.
You can use the Convert
class to convert to date
textBlock8.Text = Convert.ToDateTime(reader.GetString("Data")).ToString("dd/MM/yyyy")
or use DateTime
to give Parse in string
textBlock8.Text = DateTime.Parse(reader.GetString("Data")).ToString("dd/MM/yyyy")