Page 2 of 2 FirstFirst 12
Results 21 to 33 of 33
Like Tree1Likes

Thread: Integer Dates to String Dates Problem

  1. #21
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    340
    Rep Power
    5

    Default Re: Integer Dates to String Dates Problem

    Read my edited comment. The problem is that the i in the for loop should be incremented by 3.

  2. #22
    Join Date
    Jun 2013
    Posts
    66
    Rep Power
    0

    Default Re: Integer Dates to String Dates Problem

    so right now its suppose to be one more or one less than the actual month???

  3. #23
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    340
    Rep Power
    5

    Default Re: Integer Dates to String Dates Problem

    My mistake. You need to subtract 1 from the month.

    Java Code:
    int month = (dataValue[i+1])-1;
    HelpingIsCaring likes this.

  4. #24
    Join Date
    Jun 2013
    Posts
    66
    Rep Power
    0

    Default Re: Integer Dates to String Dates Problem

    so i need to find a method that gives me the suffix for the dates now?? is it hard to just write it??? the who's online thing tells me that you are here. lol. well, ill be waiting for your reply and thanks again for helping me so much since like 3 hours ago! that takes commitment!
    Last edited by HelpingIsCaring; 08-20-2013 at 10:16 PM.

  5. #25
    Join Date
    Jun 2013
    Posts
    66
    Rep Power
    0

    Default Re: Integer Dates to String Dates Problem

    hello?

  6. #26
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    340
    Rep Power
    5

    Default Re: Integer Dates to String Dates Problem

    Writing it may actually be a good exercise for you. I'll give you the shell for the method, you just figure out the logic.

    Java Code:
    private String getSuffix(int dayOfMonth) {
    
    }
    Remember, the job of the method is to take in an int (12,13,1, etc), and return to you the suffix that is appropriate (st, nd, rd, th). Think about a number that might be passed to your method, and how would you determine what the appropriate suffix would be. Once you figure out the logic and can talk it out, try to translate that to code.

  7. #27
    Join Date
    Jun 2013
    Posts
    66
    Rep Power
    0

    Default Re: Integer Dates to String Dates Problem

    thanks for the hit! ill gonna go eat now, be back in like 20 min. Don't log off on me!!!!!!!!

  8. #28
    Join Date
    Jun 2013
    Posts
    66
    Rep Power
    0

    Default Re: Integer Dates to String Dates Problem

    Quote Originally Posted by sehudson View Post
    Writing it may actually be a good exercise for you. I'll give you the shell for the method, you just figure out the logic.

    Java Code:
    private String getSuffix(int dayOfMonth) {
    
    }
    Remember, the job of the method is to take in an int (12,13,1, etc), and return to you the suffix that is appropriate (st, nd, rd, th). Think about a number that might be passed to your method, and how would you determine what the appropriate suffix would be. Once you figure out the logic and can talk it out, try to translate that to code.
    how bout a switch statement? hhhmmmm
    Java Code:
    public static String getSuffix(int dayOfMonth) {
            switch (n % ??) {
                case 1:
                    return "st";
                case 2:
                    return "nd";
                case 3:
                    return "rd";
                default:
                    return "th";
            }
        }
    }
    Last edited by HelpingIsCaring; 08-20-2013 at 11:45 PM.

  9. #29
    Join Date
    Jun 2013
    Posts
    66
    Rep Power
    0

    Default Re: Integer Dates to String Dates Problem

    well, its been a few days since i started this program, i need to go faster so im gonna go head and skip this enhancement step of adding suffixes to the dates. Im still need to write it to a file and everything. Maybe after im done with all the important things, ill go back and try to add suffixes. Well, thanks again to sehudson for helping me out here!!!! and db who gave me the idea of using SimpleDateFormat.

  10. #30
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    340
    Rep Power
    5

    Default Re: Integer Dates to String Dates Problem

    Have you tried the File writing portion at all?

  11. #31
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Integer Dates to String Dates Problem

    Quote Originally Posted by HelpingIsCaring View Post
    how bout a switch statement? hhhmmmm
    Java Code:
    public static String getSuffix(int dayOfMonth) {
            switch (n % ??) {
                case 1:
                    return "st";
                case 2:
                    return "nd";
                case 3:
                    return "rd";
                default:
                    return "th";
            }
        }
    }
    Hmm. 9th, 10th, 11st, 12nd, 13rd, 14th ...

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  12. #32
    Join Date
    Jun 2013
    Posts
    66
    Rep Power
    0

    Default Re: Integer Dates to String Dates Problem

    [QUOTE=sehudson;351259]Have you tried the File writing portion at all?
    well, the file was already created, i just ahd to pass the string dates into it. As of now, this is done!But, i still need to figure out how to make the dates binary as requested. Maybe u can give me some hits??

  13. #33
    Join Date
    Jun 2013
    Posts
    66
    Rep Power
    0

    Default Re: Integer Dates to String Dates Problem

    Quote Originally Posted by DarrylBurke View Post
    Hmm. 9th, 10th, 11st, 12nd, 13rd, 14th ...

    db
    yeah, its really flawed xD

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Holiday Dates HELP PLEASE!
    By rampage12345 in forum New To Java
    Replies: 3
    Last Post: 10-21-2012, 06:42 AM
  2. Dates sometimes off by a day?
    By saggio in forum Advanced Java
    Replies: 13
    Last Post: 12-08-2010, 04:56 PM
  3. UTC Dates
    By PedroCosta in forum Advanced Java
    Replies: 3
    Last Post: 04-01-2010, 06:08 PM
  4. missing dates problem in ireport
    By javastuden in forum Advanced Java
    Replies: 0
    Last Post: 12-18-2009, 05:11 AM
  5. Help with dates
    By bumblyb33 in forum New To Java
    Replies: 1
    Last Post: 02-13-2009, 02:54 PM

Posting Permissions

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