DataSet parse date "dd/mm/yyyy"
-
I'm using dataset for get values the table on access. The field date_ is shown in listview on format mm/dd/yyyy, but i need format dd/mm/yyyy. I load values in listview with the code: listview_.DataContext = _dataSet; I tried:
string strDate = _dataset.Table["table"].Rows[0]["field_date"].ToString();
_dateset.Tables["table"].Rows[0]["field_date"] = DateTime.ParseExact(strDate, "dd/MM/yyyy", CultureInfo.CurrentCulture);
But not work. What can i do ?
-
I'm using dataset for get values the table on access. The field date_ is shown in listview on format mm/dd/yyyy, but i need format dd/mm/yyyy. I load values in listview with the code: listview_.DataContext = _dataSet; I tried:
string strDate = _dataset.Table["table"].Rows[0]["field_date"].ToString();
_dateset.Tables["table"].Rows[0]["field_date"] = DateTime.ParseExact(strDate, "dd/MM/yyyy", CultureInfo.CurrentCulture);
But not work. What can i do ?
-
juliogyn wrote:
What can i do ?
Support on formatting a column in a ListView[^]
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
I'm using dataset for get values the table on access. The field date_ is shown in listview on format mm/dd/yyyy, but i need format dd/mm/yyyy. I load values in listview with the code: listview_.DataContext = _dataSet; I tried:
string strDate = _dataset.Table["table"].Rows[0]["field_date"].ToString();
_dateset.Tables["table"].Rows[0]["field_date"] = DateTime.ParseExact(strDate, "dd/MM/yyyy", CultureInfo.CurrentCulture);
But not work. What can i do ?
As per this answer: Source
Simple change the StringFormat in your binding.
DisplayMemberBinding="{Binding Path=field_date, StringFormat='dd/MM/yyyy'}"
I wasn't, now I am, then I won't be anymore.
-
As per this answer: Source
Simple change the StringFormat in your binding.
DisplayMemberBinding="{Binding Path=field_date, StringFormat='dd/MM/yyyy'}"
I wasn't, now I am, then I won't be anymore.
-
I'm using dataset for get values the table on access. The field date_ is shown in listview on format mm/dd/yyyy, but i need format dd/mm/yyyy. I load values in listview with the code: listview_.DataContext = _dataSet; I tried:
string strDate = _dataset.Table["table"].Rows[0]["field_date"].ToString();
_dateset.Tables["table"].Rows[0]["field_date"] = DateTime.ParseExact(strDate, "dd/MM/yyyy", CultureInfo.CurrentCulture);
But not work. What can i do ?
I want to add.. DateTime.TryParse(x) is a good method to see if the date is even going to parse first.. also... it does not account for null data.. so you may need to add a little logic there to handle null.
=)
-
I want to add.. DateTime.TryParse(x) is a good method to see if the date is even going to parse first.. also... it does not account for null data.. so you may need to add a little logic there to handle null.
=)