• Post Reply Bookmark Topic Watch Topic
  • New Topic

DateField Question  RSS feed

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.
Posts: 5167
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 http://www.coderanch.com/forums/f-41/JME . Expect to find it moved there by a moderator.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!