• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting calendar to an arbitrary date

 
Igor Mechnikov
Ranch Hand
Posts: 100
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code does not work because there is no set method for Calendar and setTime errs because it's a non-static method.
Is setting up GregorianCalendar the simplest way to set Calendar given an input string "M/d/yy"?



Thank you.
 
Paul Clapham
Sheriff
Posts: 21155
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need a Calendar object to start with. If you read the documentation for java.util.Calendar it tells you in the introduction exactly how to do that.
 
Rob Spoor
Sheriff
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ilya Mechnikov wrote:

So why not create an instance using Calendar.getInstance()?
 
Igor Mechnikov
Ranch Hand
Posts: 100
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got this to work



Thank you for your help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic