It seems that the error comes if you enter the Z/T to the end of parse
string.
-------------------------------------------------------------------------
CODE 1:
System.Globalization.CultureInfo provider = new
System.Globalization.CultureInfo("tr-TR");

DateTime dt = DateTime.ParseExact( "1984-09-17T09:00:00",
"yyyy-MM-dd'T'HH:mm:ss.FFF",provider);
-------------------------------------------------------------------------
OUTPPUT 2:
9/17/1984 9:00:00 AM
-------------------------------------------------------------------------
CODE 2:
System.Globalization.CultureInfo provider = new
System.Globalization.CultureInfo("tr-TR");
 DateTime dt = DateTime.ParseExact( "1984-09-17T09:00:00Z",
"yyyy-MM-dd'T'HH:mm:ss.FFF'Z'",provider);
-------------------------------------------------------------------------
OUTPPUT 2:
Unhandled Exception: System.FormatException: Invalid format string
  at System.DateTime.ParseExact (System.String s, System.String[] formats,
IFor
atProvider provider, DateTimeStyles style) [0x00000] in <filename unknown>:0
  at System.DateTime.ParseExact (System.String s, System.String format,
IFormat
rovider provider, DateTimeStyles style) [0x00000] in <filename unknown>:0
  at System.DateTime.ParseExact (System.String s, System.String format,
IFormat
rovider provider) [0x00000] in <filename unknown>:0
  at testDate.Program.Main (System.String[] args) [0x00000] in <filename
unknow
>:0
-------------------------------------------------------------------------
MONO VER: (testted for both versions)
Mono JIT compiler version 2.10.2 (tarball)
Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.co
        TLS:           normal
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)
-------------------------------------------------------------------------

On Thu, Sep 22, 2011 at 4:55 PM, Nicklas Overgaard <nick...@isharp.dk>wrote:

>  Thanks, wasen't sure of the bug report url after novell's demise.
>
> Posted as bug: http://bugzilla.xamarin.com/show_bug.cgi?id=992
>
> /Nicklas
>
>
> On 2011-09-22 12:39, Marek Safar wrote:
>
> Hi,
>
> Please fill a bug report at http://bugzilla.xamarin.com/
>
> Thanks
> Marek
>
> Nodbody?
>
> Anywho, since it's an incompability with .net I guess that I should file a
> bug somewhere?
>
> Best regards,
>
> Nicklas
>
> On 2011-09-19 00:04, Nicklas Overgaard wrote:
>
> Yes, i'm very sure - it's copy-paste from the solrnet source code:
> https://github.com/mausch/SolrNet/blob/master/SolrNet/Impl/FieldParsers/DateTimeFieldParser.cs
>
> And the code-snippet I attached below does indeed work on windows in .net
> :)
>
> /Nicklas
>
> On 2011-09-18 23:00, Stefano Canepa wrote:
>
> 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
>
>
>
>
>
> _______________________________________________
> Mono-devel-list mailing 
> listMono-devel-list@lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
> _______________________________________________
> Mono-devel-list mailing 
> listMono-devel-list@lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
>
> _______________________________________________
> Mono-devel-list mailing 
> listMono-devel-list@lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>


-- 
Hüseyin Çakır
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to