Last active
August 29, 2015 14:13
-
-
Save markusjohnsson/20090ba9cf7c4132cabb to your computer and use it in GitHub Desktop.
Month View Calendar...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var today = DateTime.Today; | |
var start = new DateTime(today.Year, today.Month, 1); | |
//for (var s = start | |
PrintMonth(start); | |
start.AddMonths(1); | |
} | |
public static void PrintMonth(DateTime start) | |
{ | |
Console.WriteLine(start.ToString("MMMM")); | |
for (var i = 0; i < (int)start.DayOfWeek; i++) | |
Console.Write(" \t"); | |
for ( | |
var current = start; | |
current.Month == start.Month; | |
current = current.AddDays(1)) | |
{ | |
if (current.DayOfWeek == 0) | |
Console.WriteLine(); | |
Console.Write(current.Day.ToString().PadLeft(2) + "\t"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment