wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Date class problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date class problems" Watch "Date class problems" New topic
Author

Date class problems

Pedro Neves
Ranch Hand

Joined: Mar 07, 2012
Posts: 64
Hello, well i'm having some trouble with the date class:







I guess this is allright but then the output is:

####### day = 19
%%%%%%% day = 0

:S Can somebody help please?

Kind regards
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4165
    
  21

Pedro Neves wrote:I guess this is allright but then the output is:

####### day = 19
%%%%%%% day = 0

:S Can somebody help please?


First: You should read the API for the java.util.Date (<- click) so you can see what it does. Once you do that you should realize why the returned value is zero. You should also understand that the Date#getDate() method is deprecated and an alternative should be used (see that API for the alternative to use).


Steve
Pedro Neves
Ranch Hand

Joined: Mar 07, 2012
Posts: 64
Steve Luke wrote:
Pedro Neves wrote:I guess this is allright but then the output is:

####### day = 19
%%%%%%% day = 0

:S Can somebody help please?


First: You should read the API for the java.util.Date (<- click) so you can see what it does. Once you do that you should realize why the returned value is zero. You should also understand that the Date#getDate() method is deprecated and an alternative should be used (see that API for the alternative to use).


Many thanks.. I already has managed it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Date class problems
 
Similar Threads
Wrong month
What fields does java.util.Date.equals compare?
Possble Calendar bug with daylight saving time
appointment find (Date d, time t)
Cannot Convert String to Int. Clock question.