datetime today c# code example
Example 1: c# get current date
DateTime now = DateTime.Now;
Example 2: c# get today's date
DateTime today = DateTime.Today;
Example 3: c# datetime current
DateTime now = DateTime.Now;
string strDate = now.ToString("YYYY-MM-dd");
Example 4: check if current time is in the morning c#
TimeSpan time = DateTime.Now.TimeOfDay;
if (time > new TimeSpan(00, 00, 01) //Hours, Minutes, Seconds
&& time < new TimeSpan(08, 00, 00)) {
//match found
}