1
I have the following code that dates the Mysql database to textblock:
textBlock8.Text = (reader.GetString("Data"));
What happens is that it is passing the date and time. I would like to pass only the date.
1
I have the following code that dates the Mysql database to textblock:
textBlock8.Text = (reader.GetString("Data"));
What happens is that it is passing the date and time. I would like to pass only the date.
1
You can use the class Convert
, to convert to date
textBlock8.Text = Convert.ToDateTime(reader.GetString("Data")).ToString("dd/MM/yyyy")
or use the DateTime
to give a Parse in string
textBlock8.Text = DateTime.Parse(reader.GetString("Data")).ToString("dd/MM/yyyy")
Browser other questions tagged c# mysql visual-studio-2015
You are not signed in. Login or sign up in order to post.
You’re getting a date text, right? The date format is guaranteed to always be the same? What would it be?
– Maniero
If you do
GetString("Data").ToString("dd-MM-yyyy")
doesn’t work?– igventurelli