[Mono-dev] DateTime.ParseExact bug ?

Stefano Canepa sc at linux.it
Sun Sep 18 17:00:36 EDT 2011



Nicklas Overgaard  at "Sun, 18 Sep 2011 18:34:08 +0200" wrote:
 NO> Hi,

 NO> I'm currently working with Solr and SolrNet for a project. However, i'm 
 NO> encountering errors when SolrNet is parsing date times...

 NO> I have located the date-time parsing code in SolrNet, and made a sample 
 NO> test application shown below:

 NO> <code start>
 NO> using System;
 NO> using System.Linq;
 NO> using System.Globalization;

 NO> namespace datetimeparsing
 NO> {
 NO>      class MainClass
 NO>      {
 NO>          public static void Main (string[] args)
 NO>          {
 NO>              string s = "1984-09-17T09:00:00Z";
 NO>              DateTime dt=  DateTime.ParseExact(s, 
 NO> "yyyy-MM-dd'T'HH:mm:ss.FFF'Z'", CultureInfo.InvariantCulture);
 NO>          }
 NO>      }
 NO> }
 NO> </code end>

Are you sure about the format string? I think that you need to write only
FF'Z instead of FFF'Z. Did you take a look at mono source code?

Bye
Stefano

-- 
Stefano Canepa aka sc: sc at linux.it - http://www.stefanocanepa.it
Three great virtues of a programmer: laziness, impatience and hubris.
Le tre grandi virtù di un programmatore: pigrizia, impazienza e
arroganza. (Larry Wall)


More information about the Mono-devel-list mailing list