Extracing the Date Part from a DateTime object

By [)ia6l0 iii

Get date Only from the Datetime object in .Net

The DateTime object has the "Date" Property that helps you retreive the Date alone. See the following snippet:

DateTime fullDate = DateTime.Now;
string fullDateString = fullDate.ToString();

DateTime datealone = fullDate.Date;
string datealoneString = datealone.ToString("d");

Extracing the Date Part from a DateTime object  (719 Views)