aspose file tools*
The moose likes Beginning Java and the fly likes setting calendar to an arbitrary date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "setting calendar to an arbitrary date" Watch "setting calendar to an arbitrary date" New topic
Author

setting calendar to an arbitrary date

Igor Mechnikov
Ranch Hand

Joined: Feb 13, 2011
Posts: 100

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.


String knock = "\u042F \u0418\u0433\u043e\u0440\u044c";
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

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

Joined: Oct 27, 2005
Posts: 19784
    
  20

Ilya Mechnikov wrote:

So why not create an instance using Calendar.getInstance()?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Igor Mechnikov
Ranch Hand

Joined: Feb 13, 2011
Posts: 100

I got this to work



Thank you for your help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: setting calendar to an arbitrary date