I need to format current DateTime like this:
Mon, 18 Mar 2019 15:10:24 0000
but i can't find the specific Format string in C#. The documentation required this string format:
EEE, dd MMM yyyy HH:mm:ss O
I try :
DateTime.Now.ToString("r") but it returns GMT instead of 0000 part.
DateTime.Now.ToString("ddd, dd MMM yyyy HH:mm:ss zzz") but it returns 02:00 instead of 0200 part.
How can i format the date?
CodePudding user response:
Try:
DateTime d = DateTime.Now;
d.ToString("ddd, dd MMM yyyy HH:mm:ss zz00")
