working with datetime
-
Hi all, how can i get the last day of a given month. thanks.
-
Hi all, how can i get the last day of a given month. thanks.
DateTime.DaysInMonth
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
Hi all, how can i get the last day of a given month. thanks.
a solution: int year = DateTime.Now.Year; DateTime dt = DateTime.Parse(year.ToString() + GivenMonth); dt.Day = DateTime.DaysInMonth(year, GivenMonth);
-
a solution: int year = DateTime.Now.Year; DateTime dt = DateTime.Parse(year.ToString() + GivenMonth); dt.Day = DateTime.DaysInMonth(year, GivenMonth);
I doubt this code will work. In line 2 you're using GivenMonth as a
string
and then in line 3 as aint
.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook