I got a runtime error for the following C# code which is converted from
java to C# by .net conversion tool.
Error: out of range exception "Ticks must be between
DataTime.MinValue.Ticks and DateTime.MaxValue.Ticks"
I know "Ticks * 10000L + 621355968000000000"caused this error, but I do
not know how to fix it.
Thank you very much.
Daniel
The original java:
private java.sql.Date convertDate( Calendar calendar )
{
// calendar .getTime() returns a util.Date
//and we need to construct a
// sql.Date object. So call getTime() on the
// util.Date object to return
// a long representing milliseconds.
return new java.sql.Date( calendar.getTime().getTime() );
}
The converted C# code:
private System.DateTime convertDate
(System.Globalization.Calendar calendar)
{
return new System.DateTime
(SupportClass.CalendarManager.manager.GetDateTime
(calendar).Ticks * 10000L +
621355968000000000).ToLocalTime();
}
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!