I'm creating a table and need the columns to be created as follows: Mon, 23 Nov | Tue, 24 Nov | Wed, 25 Nov | Thu, 26 Nov | Fri, 27 Nov | Sat, 28 Nov | Sun, 29 Nov
To create the table I pass by a date parameter (which is selected through a calendar)
I'm doing this to create the Table:
DateTime diaAgenda = 'Data que foi selecionada no calendario';
public DataTable gerarAgenda(DateTime dia)
{
DataTable tabela = new DataTable();
string diahoje = String.Format("{0:ddd, MMM d, yyyy}", dia);
tabela.Columns.Add("" + diahoje);
for (int data = 1; data < 7; data++)
{
dia = dia.AddDays(1);
diahoje = String.Format("{0:ddd, MMM d, yyyy}", dia);
tabela.Columns.Add("" + diahoje);
}
return tabela;
}
In this way, the table that I generate will have the following columns:
Thu, 26 Nov | Fri, 27 Nov | Sat, 28 Nov | Sun, 29 Nov | Mon, 30 Nov | Tue, Dec 01 | Wed, Dec 02 |
How could I do to create the columns like this:
Mon, 23 Nov | Tue, 24 Nov | Wed, 25 Nov | Thu, 26 Nov | Fri, 27 Nov | Sat, 28 Nov | Sun, 29 Nov