Time and time format

I have a DateTime object. I want to return a string formatted below:

Thu, June 6, 2010 16:00:00 +0200

This is my code:

DateTime.Now.ToString("ddd, dd MMMM yyyy HH:mm:ss zzz");

Result:

Thu, 10 Juni 2010 18:33:14 +02: 00

Is there a built-in way to get the time zone difference without formatting :? (without manual removal: I don’t know if there are any complications if I do this)

+5
source share
2 answers

( ), , . zz, "+02", ... 00 "" ( - ) : . DateTimeFormatInfo h: m: s, d/m/y, ; , DateTimeFormatInfo.TimeSeparator (h: m), : snce , DateTimeFormatInfo.TimeSeparator; zz 00 ... .

+1

, "o", - . .

DateTime.Now.ToString("o") => 2012-08-17T17:31:19.7538909+08:00
+3

All Articles