• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date class problems

 
Pedro Neves
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
21
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Pedro Neves
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic