Two Laptop Bag
The moose likes Beginning Java and the fly likes DateField Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "DateField Question" Watch "DateField Question" New topic

DateField Question

Random Dood

Joined: Sep 25, 2010
Posts: 2

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

Joined: May 03, 2008
Posts: 5115

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.

luck, db
There are no new questions, but there may be new answers.
I agree. Here's the link:
subject: DateField Question
It's not a secret anymore!