[ 
https://issues.apache.org/jira/browse/LUCENENET-409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020569#comment-13020569
 ] 

Digy commented on LUCENENET-409:
--------------------------------

No need for a separate issue.
Here is the code from Lucene.Net 2.4.0.
{code}
public static System.DateTime StringToDate(System.String s)
{
        long ticks = StringToTime(s) * TimeSpan.TicksPerMillisecond;
        System.DateTime date = new System.DateTime(1970, 1, 1);
        date = date.AddTicks(ticks);
        date = date.Add(TimeZone.CurrentTimeZone.GetUtcOffset(date));
        return date;
}
{code}

It is lost somehow in 2.9

Is this OK?

DIGY

> Invalid Base exception in DateField.StringToTime()
> --------------------------------------------------
>
>                 Key: LUCENENET-409
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-409
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net Core
>    Affects Versions: Lucene.Net 2.9.4
>            Reporter: Neal Granroth
>         Attachments: DateField.patch
>
>
> The Lucene.Net.Documents.DateField.StringToTime() method called by 
> StringToDate() appears to specify an invalid value for the base in the .NET 
> Convert.ToInt64() call.  When a DateField value in a legacy index is read, or 
> Lucene.NET 2.9.4 is used with legacy code that relies upon DateField, the 
> following exception occurs whenever StringToDate() is called:
> System.ArgumentException: Invalid Base.
>    at System.Convert.ToInt64(String value, Int32 fromBase)
>    at Lucene.Net.Documents.DateField.StringToTime(String s)
>    at Lucene.Net.Documents.DateField.StringToDate(String s)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to