Search code examples
c#datetimestring-formatting

How to Convert a datetime to Long Date?


Below is my code,

DateTime DateFrom_ = Convert.ToDateTime(CSO.dateFrom);

I am getting the value currently like - 29/10/2019 00:00:00 what i want is I want to convert above to this format - Tue, 29 Oct 2019

can anyone please guide me how to do this, Thank you.


Solution

  • Below one worked for me,

    DateTime DateFrom_ = Convert.ToDateTime(CSO.dateFrom);    
    var convertedDate = DateFrom_.ToString("ddd', 'dd' 'MMM' 'yyyy");