• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

integer number too large:

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im storing dates in a table using System.currentTimeMillis() format.

To read them back I tried this

Date currentDatetime = new Date(1133382920156);
SimpleDateFormat formatter = new SimpleDateFormat("hh:mm dd-MMMM-yyyy zz" );
String myDate = formatter.format(currentDatetime);

Then display myDate. But im getting integer number too large: error:

It works fine if I do this.
Date currentDatetime = new Date(System.currentTimeMillis());
SimpleDateFormat formatter = new SimpleDateFormat("hh:mm dd-MMMM-yyyy zz" );
String myDate = formatter.format(currentDatetime);


thans
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To make java interpret your number as a long, take an 'l' or 'L' on the end to indicate it

Date currentDatetime = new Date(1133382920156L);
 
Sheriff
Posts: 67596
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to Java in General (intermediate)
 
reply
    Bookmark Topic Watch Topic
  • New Topic