• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

calculate with dates

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to have 2 dates on a midlet but it seems that it das not work.
the java code that I want to translate to a Midlet is this.
GregorianCalendar day = new GregorianCalendar();
GregorianCalendar back = new GregorianCalendar();
back.add(Calendar.DATE, -35);
Date d = day.getTime();
Date e = back.getTime();
DateFormat A = DateFormat.getDateInstance(DateFormat.LONG);
DateFormat C = DateFormat.getDateInstance(DateFormat.LONG);
String B = A.format(d);
String T = C.format(e);
whats wrong.
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Move to General Computing or Java - Intermediate
 
bs vest
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
private Date today,yday;
private Calendar cal;
{
today = new Date(System.currentTimeMillis());
cal = Calendar.getInstance();
yday = cal.getTime();
long time = yday.getTime();
long time2 = 35 * 86400000;
long time3 = today.getTime();
time = time3 - time2;
yday = new Date(time);
}
whats wrong in this code.
 
Liar, liar, pants on fire! refreshing plug:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic