473,473 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Conversion from java to c#

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!
Nov 16 '05 #1
0 1633

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Charles Atwood | last post by:
I am trying to use the Java Language Conversion Assistant 2.0 with Visual Studio .NET 2003 on Windows 2000 Server SP4 and .NET framework 1.1 to convert some java files to C#. I go through all the...
1
by: vadala | last post by:
The requirement is to send start data and end date from java to UI (.net) for a functionality. We are setting the time in java (1.5) before handing it over to WebService (sending to UI ) in...
9
by: =?Utf-8?B?RmxhdmVsbGUgQmFsbGVt?= | last post by:
Apparently the Java Conversion tool that used to be in Visual Studio 2005 is no longer supported in Visual Studio 2008. Anyone have any suggestions on how to convert a Java program to C# in Visual...
4
by: Ty | last post by:
Hello all, I am creating a website in VS 2008 VB.net. On one of my pages I am using the Table control to make a type of calendar a IN/OUT board. The problem I found after I wrote all the code...
1
oll3i
by: oll3i | last post by:
E:\ECLIPS~1\ZADANIE3\SRC\EJB>javac -Xlint:unchecked ManageDBBean.java ManageDBBean.java:34: warning: unchecked conversion found : java.util.HashMap required:...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.