[Mono-list] Patch for DataTime.cs

Alan Tam Tam@SiuLung.com
Fri, 28 Feb 2003 02:31:58 +0800


Elan,

Please update your cvs to see if my patch solved these two. I suppose it does.

My patch does a bit more, because a DateTime may not only hold a dateTime, but
also some other types, so it should be able to parse them too. As a result,
there is a huge list of formats to test for.

I am now looking at your corlib patches.

Regards,
Alan

----- Original Message -----
From: "Elan Feingold" <efeingold@mn.rr.com>
To: "'Alan Tam'" <Tam@SiuLung.com>; "'Mono-List'" <mono-list@ximian.com>
Sent: Friday, February 28, 2003 2:09 AM
Subject: RE: [Mono-list] Patch for DataTime.cs


> > Interestingly, I am also doing something related to DateTime, but in
> > System.Xml.XmlConverter. It seems that in Mono, "zzzzzz" does not
> work. And I
> > cannot find its definition in MS's doc too.
>
> OK, we may have overlapped there. I changed XmlConvert.ToDateTime() to:
>
> public static DateTime ToDateTime(string s)
> {
>             string format = "yyyy-MM-ddTHH:mm:sszzzzzz";
>             return DateTime.ParseExact(s, format, null);
> }
>
> and
>
> public static string ToString(DateTime value)
> {
> return (value.ToString("s",
> CultureInfo.InvariantCulture) +
>                     value.ToString ("zzz"));
> }
>
> This makes it match the MS impl., and lets the XML [de]serialization I'm
> working on work perfectly.
>
> > The three characters are Byte Order Mark (BOM) of UTF-8 encoding. It
> should
> > have been surpressed by your terminal, if it is implemented correctly.
>
> Cool, I just changed PuTTY and now it works perfectly. Thanks!!!!
>
> -elan
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>