c# datetime now to int code example
Example 1: c# datetime current
DateTime now = DateTime.Now;
string strDate = now.ToString("YYYY-MM-dd");
Example 2: C# datetime.now to string only numbers
DateTime.Now.ToString("yyyyMMddHHmmss"); // case sensitive