DateTimeFormatInfo Class Bug - Time Zone Offset has an illegal character - needs to be removed.
From: Pure Krome (justina_at__NOSPAM_stargatetech.com.au)
Date: 08/10/04
- Next message: Felix Wang: "Re: Repost: Windows service installer"
- Previous message: angus: "Re: csv problem"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Aug 2004 12:56:38 +1000
Hi All.
.Net Framework Version: 1.1
Class: System.Globalization.DateTimeFormatInfo
Error: The Full TimeZone Offset is printing an illegal character in the
returned result. The <TimeSeperator> (by default a colon) is being
returned as part of the result: +/- HH<TimeSeperator>MM. This does not
conform to RFC 822 standards. It should be +/- HHMM.
Description:
The .NET help file lists the full time zone offset ("zzz") as the following:
"The full time zone offset ("+" or "-" followed by the hour and
minutes). Single-digit hours and minutes will have leading zeros. For
example, Pacific Standard Time is "-08:00"."
***
The colon should not be there (based upon the RFC standards). I'm
assuming the colon is the TimeSeperator.
***
This error was first noticed when i tried opening up an email (in
outlook 2002 and outlook 2003) i manually created (raw, using telnet)
and setting the date smtp field with a time zone offset as listed above
.. with the colon. Outlook was showing me an incorrect date when i
opened up the individual email.
Looking at the SMTP RFC (RFC 821 - Simple Mail Transfer Protocol,
http://www.faqs.org/rfcs/rfc821.html) and searching for <zone> it lists
the following:-
"<time> ::= <hh> ":" <mm> ":" <ss> <SP> <zone>
<zone> ::= "UT" for Universal Time (the default) or other
time zone designator (as in [2])."
ok.. so what are the zone definitions??? lets look at [2]..
"[2] RFC 822
Crocker, D., "Standard for the Format of ARPA Internet Text
Messages," RFC 822, Department of Electrical Engineering,
University of Delaware, August 1982."
this goes to ...
RFC 822 - Standard for the format of ARPA Internet text messages
(http://www.faqs.org/rfcs/rfc822.html)
searching for zone lists ...
"time = hour zone ; ANSI and Military
zone = "UT" / "GMT" ; Universal Time
; North American : UT
/ "EST" / "EDT" ; Eastern: - 5/ - 4
/ "CST" / "CDT" ; Central: - 6/ - 5
/ "MST" / "MDT" ; Mountain: - 7/ - 6
/ "PST" / "PDT" ; Pacific: - 8/ - 7
/ 1ALPHA ; Military: Z = UT;
; A:-1; (J not used)
; M:-12; N:+1; Y:+12
/ ( ("+" / "-") 4DIGIT ) ; Local differential
; hours+min. (HHMM)"
Notice the last comment / line.
==>> a plus or mine followed by 4DIGIT (HHMM). There is no TimeSeperator
in there.
If outlook recieves an email with an smtp date that conforms to the
above time zone offset standard, it is displayed correctly.
So if we try to create an smtp email and define the smtp date field
using the .NET "zzz" format pattern, it is technically incorrect and
could be displayed incorrectly.
Workaround:
this is the current piece of code i use to get around this bug until it
is fixed / properly formatted. (sorry about the bad formatting).
objBuffer.Append( this.DateTime.ToString( "dddd, d MMMM yyyy HH:mm:ss " ) );
objBuffer.Append( this.DateTime.ToString( "zzz" ).Replace(
System.Globalization.DateTimeFormatInfo.CurrentInfo.TimeSeparator, "" ) );
notice i manually remove the TimeSeperator from the TimeZoneOffset string.
Please comment and fix :)
I hope someone at MS reads this.... otherwise, how can i report this
easy to fix bug?
-- - Pure Krome - * I Live therefore I am Happy; I am Happy therefore I Live. * What Nourishes Me Also Destroys Me - Angelina Jolie (Stomach Tattoo) _____________________________________________________________________
- Next message: Felix Wang: "Re: Repost: Windows service installer"
- Previous message: angus: "Re: csv problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|