tanijja

Beer time

Mar 27th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2.     class Program
  3.     {
  4.         static void Main(string[] args)
  5.         {
  6.                 string startTime = "1:00 PM";
  7.                 DateTime stratT = Convert.ToDateTime(startTime);
  8.                 string endTime = "3:00 AM";
  9.                 DateTime endT = Convert.ToDateTime(endTime);
  10.                 DateTime now = DateTime.Now;
  11.                 string time = now.ToString("hh:mm tt");
  12.                 if ((now >= endT) && (now <= stratT))
  13.                 {
  14.                     Console.WriteLine("non-beer time");
  15.                 }
  16.                 else
  17.                 {
  18.                     Console.WriteLine("beer time");
  19.                 }
  20.  
  21.         }
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment