Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help please

    Reyt, so I'm looking to have the difference between two sets of days counted right? This is the code I have:

    int diff;
    diff = futureDate - day;
    System.out.println(diff + " days difference");

    Problem is, when I type this in:

    aDay.Setday((byte)6);
    aDay.ShowDate();
    aDay.CountDays(1);

    The print is coming up as:

    Sunday
    -5 days difference

    So, how do I change this so it doesn't add the negative value? All help is greatly appreciated.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    In the future, use a title more appropriate for the problem at hand. Saying you need help is of no help to us.
    Use the java.lang.Math class to determine the absolute value. This can also be calculated by determining if a number is less than 0 and multiplying it by -1.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •