Current date without time

Use the Date property: Gets the date component of this instance.

var dateAndTime = DateTime.Now;
var date = dateAndTime.Date;

variable date contain the date and the time part will be 00:00:00.

or

Console.WriteLine(DateTime.Now.ToString("dd/MM/yyyy"));

or

DateTime.ToShortDateString Method-

Console.WriteLine(DateTime.Now.ToShortDateString ());

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)