# Thread: Integer Dates to String Dates Problem

1. ## 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. Member
Join Date
Jun 2013
Posts
71
Rep Power
0

## Re: Integer Dates to String Dates Problem

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

3. ## 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;`

4. Member
Join Date
Jun 2013
Posts
71
Rep Power
0

## 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. Member
Join Date
Jun 2013
Posts
71
Rep Power
0

hello?

6. ## 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. Member
Join Date
Jun 2013
Posts
71
Rep Power
0

## 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. Member
Join Date
Jun 2013
Posts
71
Rep Power
0

## Re: Integer Dates to String Dates Problem

Originally Posted by sehudson
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. Member
Join Date
Jun 2013
Posts
71
Rep Power
0

## 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. ## Re: Integer Dates to String Dates Problem

Have you tried the File writing portion at all?

11. ## Re: Integer Dates to String Dates Problem

Originally Posted by HelpingIsCaring
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

12. Member
Join Date
Jun 2013
Posts
71
Rep Power
0

## 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. Member
Join Date
Jun 2013
Posts
71
Rep Power
0

## Re: Integer Dates to String Dates Problem

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

db
yeah, its really flawed xD

Page 2 of 2 First 12

#### Posting Permissions

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