Setting the Date Format when retrieving from a Typed List

Posts   
 
    
JMitchell avatar
JMitchell
User
Posts: 128
Joined: 01-Sep-2006
# Posted on: 27-Sep-2006 17:51:11   

VB.NET 2003, LLBLGen Pro 1.0.2005.1

I am having problems setting the format of the date in a DataListView.


Dim folkList As New PeopleDetailListTypedList
folkList = GetPeople()

With Me.dvDisplay
    .AutoDiscover = False
    .Columns.Add("Date Of Birth", "DOB", dvDisplay.Width / 3)
    .Columns.Add("First Name", "FirstName", dvDisplay.Width / 3)
    .Columns.Add("Last Name", "LastName", dvDisplay.Width / 3)
    .DataSource = folkList

The code above results in the date being displayed in the format dd mmm yyyy (e.g. 01 May 2001) so it sorts by the day of the month rather than the date. I would like to make it yyyy MM dd (e.g. 2001 05 01) so it sorts properly.

Do I need to add something to this section of code, a different bit of code or my Typed List? If so what?

Thanks for your help,

James

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 28-Sep-2006 08:00:16   

That's a known issue in the ListView control. You may google around using words like "listview date format"

Some links addressing this issue:

Link1

Link2