Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Printing days in a week in three letter format in C#

In some systems it may be useful to display the day of the week in a three-letter form.
Here we see a simple program that prints out the days of the week in three-letter format.

  1. using System;
  2.  
  3. namespace forgetCode
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. DateTime now = DateTime.Today;
  10. for (int i = 0; i < 7; i++)
  11. {
  12. Console.WriteLine(now.ToString("ddd"));
  13. now = now.AddDays(1);
  14. }
  15. }
  16.  
  17. }
  18. }


Output:
Sun
Mon
Tue
Wed
Thu
Fri
Sat

..