This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi, I am passing a long value to the java.util.Date API - setTime() It gives me error - "integer number too large." The API signature is - public void setTime(long time) It is expecting a long, but I do not understand on passing a valid long value, it gives me error saying the integer value is too large. Please let me know what is happening here. Thanks
Hi Celina, You're gonna have to show us some code or at least the exception's stack trace before we can help you here. Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Joined: Aug 23, 2001
The code sample is - Date dtt = new Date(); dtt.setTime(10480291150); And the error that I got is - C:\perso\SampleCode>javac TestUTCDate.java TestUTCDate.java:14: integer number too large: 10480291150 dtt.setTime(10480291150); ^ 1 error
Joined: Jan 30, 2002
Hi Celina, Oh! A compiler error!. Just add the letter L after your value: date.setTime(10480291150L) and it should work. All integral values are interpreted by the compiler as int unless you specify otherwise. Michael Morris