This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

DateField Question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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;
dateModed.setTime(longModedTime);

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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • 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 https://coderanch.com/forums/f-41/JME . Expect to find it moved there by a moderator.
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!