Advertisement
kyrathasoft

yearsDiff2

Jul 21st, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2. using TestInput;
  3. /*
  4. from Lesson 6 of C# console programming tutorial series at following URL:
  5. http://williammillerservices.com/windows-c-console-programming/
  6.  
  7. tests helper method IsDate() found in tester3.cs
  8. GitHub gist -> https://gist.github.com/kyrathasoft/076d1dcabc173536f8d345c43d177eff
  9. Pastebin.com -> https://pastebin.com/8Ud4GbwP
  10. */
  11. namespace MyNamespace
  12. {
  13.     class MyClass
  14.     {
  15.         static void Main(string[] args)
  16.         {
  17.             DateTime dt2000 = new DateTime(2000, 1, 1);
  18.             DateTime dt2001 = new DateTime(2004, 7, 15);
  19.             int iDiff = Tester.GetDifferenceInYears(dt2000, dt2001);
  20.             string sMsg = "Years between dates ";
  21.             sMsg += dt2000.ToShortDateString() + " and ";
  22.             sMsg += dt2001.ToShortDateString() + " = ";
  23.             sMsg += iDiff.ToString();
  24.             Console.WriteLine(sMsg);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement