C#:
StringBuilder sb = new StringBuilder();
for (int mth = 1; mth <= 12; mth++)
{
DateTime dt = new DateTime(2010, mth, 1);
while (dt.DayOfWeek != DayOfWeek.Monday)
{
dt = dt.AddDays(1);
}
sb.Append(Convert.ToString(dt.ToLongDateString() + " ::: " )); } Label2.Text = sb.ToString();
VB.Net:
For mth As Integer = 1 To 12
Dim dt As New DateTime(2010, mth, 1)
Do While dt.DayOfWeek <> DayOfWeek.Monday
dt = dt.AddDays(1)
Loop
Console.WriteLine(dt.ToLongDateString())
Next mth
Console.ReadLine()
Monday, December 14, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment