File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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: 18129
    
    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: 19543
    
  16

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting calendar to an arbitrary date
 
Similar Threads
Any Alternative for this CODE !!!!!!
Calendar Class
date manipulation
Calendar Object to String
Possble Calendar bug with daylight saving time