How can I convert DateTime "Thu Nov 30 19:00:00 EST 2006" to "11/30/2006"
Try something like this:
using System;
using System.Globalization;
class Example
{
static void Main()
{
DateTime dateTime = DateTime.ParseExact("Thu Nov 30 19:00:00 EST 2006",
"ddd MMM dd HH:mm:ss EST yyyy",
CultureInfo.InvariantCulture);
Console.WriteLine(dateTime.ToString("MM/dd/yyyy"));
}
}
The .NET framework does not support time zone abbreviations so I hard-coded "EST" into the format string (just something to be aware of if you will need to parse strings from multiple time zones).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With