CSharp examples for Language Basics:Date Time
Display Every week until end of year
using System;// ww w. j av a 2s. c o m using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { // Today DateTime today = DateTime.Today; int thisYear = today.Year; // Repeating DateTime date = today; do { // Output Console.WriteLine(date.ToLongDateString()); // Preparing next output (a week later) date = date.AddDays(7); } while (date.Year == thisYear); } }