Parameter passing

1

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.

    
asked by anonymous 31.03.2017 / 01:40

1 answer

1

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")
    
31.03.2017 / 01:59