This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DateField Question

Random Dood
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm currently working on my Java ME assignment and got stuck on question relating to the datefield. The question is as follows:

"Include a DateField that shows the date one day in the future from the current date/time and display both the date and time, taking into account the current time zone of the device (see the TimeZone class). The user should be able to click on the date or the time and modify it."

Below is my code stripped down to the question I'm having problems with:

private long longModedTime;
private Date dateModed;
private DateField dateFieldFutureDate;

longModedTime = dateModed.getTime();
//86400000 is one day in milliseconds.
longModedTime += 86400000;

dateFieldFutureDate = new DateField("DateField showing one day in advance", DateField.DATE , TimeZone.getDefault());


I can't seem to figure out how to pass that date object into the datefield. The datefield object only accepts (String, Iinteger, TimeZone) or (String, Int) but I have to include the TimeZone as assignment specs.

Please help, this is the last question in my assignment and I wanna get it outta the way.
Thanks in advance.
Darryl Burke
Posts: 5125
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, welcome to the Ranch!

Have you read the documentation for DateField? There are only 4 methods declared in the class, and you need to invoke one of those.

Also, beibg a Java ME question, this should have been posted in . Expect to find it moved there by a moderator.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic