2

This is related to How to set time zone of a java.util.Date?

I am trying to set in the eclipse debugger the value of

private transient long fastTime;

in a java.util.Date.

I want to set the date to sometime on 01/01/2010 which based on http://www.epochconverter.com is the value (in milliseconds) 1262362075000.

This field is supposed to be of long type but when I try to set this field (fastTime) I am told by eclipse that this value is too large for the field.

What am I doing wrong?

enter image description here

Community
  • 1
  • 1
rapt
  • 11,810
  • 35
  • 103
  • 145

2 Answers2

7

You can try:

fastTime = 1262362075000L;

cirix81
  • 119
  • 3
  • If you use just a number, java try to cast to int. You have to explicitly say it's a long and not a int adding L in the end of the number. – cirix81 Aug 29 '14 at 10:12
  • This also worked for me while debugging in IntelliJ, thank a lot :) – Bianca Jan 14 '19 at 15:13
0

I am not familiar with the Eclipse Debugger, but what is interesting here is that the error message implies that Eclipse is expecting an input of type int. Have you tried to input a smaller number in the range of int? Either for some reason Eclipse assumes that fastTime is int, or the input handling of Eclipse just allows int (or it can be adjusted somewhere, so that long is allowed, too).

Helmut
  • 1
  • On second thought, I think the `int` refers to the value I tried to assign, not to the variable I was trying to assign to (`fastTime`). – rapt Aug 28 '14 at 18:18