var lastSixMonths = Enumerable.Range(0, 12)
.Select(i => DateTime.Now.AddMonths(i -12))
.Select(date => date.ToString("MMM"));
Output :
"Mar"
"Apr"
"May"
"Jun"
"Jul"
"Aug"
"Sep"
"Oct"
"Nov"
"Dec"
"Jan"
"Feb"
var lastSixMonths = Enumerable.Range(0, 12) .Select(i => DateTime.Now.AddMonths(i -12)) .Select(date => date.ToString("MM/yyyy"));
Output :
"03/2019"
"04/2019"
"05/2019"
"06/2019"
"07/2019"
"08/2019"
"09/2019"
"10/2019"
"11/2019"
"12/2019"
"01/2020"
"02/2020"
.Select(i => DateTime.Now.AddMonths(i -12))
.Select(date => date.ToString("MMM"));
Output :
"Mar"
"Apr"
"May"
"Jun"
"Jul"
"Aug"
"Sep"
"Oct"
"Nov"
"Dec"
"Jan"
"Feb"
var lastSixMonths = Enumerable.Range(0, 12) .Select(i => DateTime.Now.AddMonths(i -12)) .Select(date => date.ToString("MM/yyyy"));
Output :
"03/2019"
"04/2019"
"05/2019"
"06/2019"
"07/2019"
"08/2019"
"09/2019"
"10/2019"
"11/2019"
"12/2019"
"01/2020"
"02/2020"
No comments:
Post a Comment