1 2 Previous Next 19 Replies Latest reply: Mar 11, 2009 5:13 PM by 807588 RSS

    Returning the string from the SimpleDateFormat

    807588
      Hi guys,

      Can someone tell me how to return the string from the SimpleDateFormat?

      I've created the method to do this, but i don't know the exact code to use. Here's my code so far...
          public String convert (Calendar gc)
          {
              String s = convert(gc);
              return // I need to return the s here, but don't know how to code it.
          }
      BTW, i've already wrote the code for the SimpleDateFormat (so if you want me post that, i will).
        • 1. Re: Returning the string from the SimpleDateFormat
          807588
          String s = convert(gc);
          Isn't that an infinite loop?

          Take a look at the API for SimpleDateFormat. What method will you call?
          • 2. Re: Returning the string from the SimpleDateFormat
            807588
            DrLaszloJamf wrote:
            String s = convert(gc);
            Isn't that an infinite loop?
            It isn't.
            DrLaszloJamf wrote:
            Take a look at the API for SimpleDateFormat. What method will you call?
            Is it to attach to s?

            equals?
            • 3. Re: Returning the string from the SimpleDateFormat
              807588
              LevelSix wrote:
              DrLaszloJamf wrote:
              String s = convert(gc);
              Isn't that an infinite loop?
              It isn't.
              Well, the recursive equivalent -- divergent code.

              >
              DrLaszloJamf wrote:
              Take a look at the API for SimpleDateFormat. What method will you call?
              equals?
              No.
              • 4. Re: Returning the string from the SimpleDateFormat
                DrClap
                DrLaszloJamf wrote:
                No.
                Face it, Dr, you're being trolled.
                • 5. Re: Returning the string from the SimpleDateFormat
                  807588
                  DrClap wrote:
                  DrLaszloJamf wrote:
                  No.
                  Face it, Dr, you're being trolled.
                  Ah, you'd think a post was troll-bait if it was about the Design Pattern "Bridge".
                  • 6. Re: Returning the string from the SimpleDateFormat
                    807588
                    DrClap wrote:
                    DrLaszloJamf wrote:
                    No.
                    Face it, Dr, you're being trolled.
                    I'm not trolling.

                    I just don't know how to complete this method.

                    I've been here for a while now and i never once messed about with anyone.

                    I honestly need help with this.
                    DrLaszloJamf wrote:
                    No.
                    Can you tell me what it is, because i've went through the API and i don't know.
                    • 7. Re: Returning the string from the SimpleDateFormat
                      807588
                      LevelSix wrote:
                      Hi guys,

                      Can someone tell me how to return the string from the SimpleDateFormat?

                      I've created the method to do this, but i don't know the exact code to use. Here's my code so far...
                          public String convert (Calendar gc)
                      {
                      String s = convert(gc);
                      return // I need to return the s here, but don't know how to code it.
                      }
                      BTW, i've already wrote the code for the SimpleDateFormat (so if you want me post that, i will).
                      Didn't we just go through the "explain what this method does" exercise?

                      Can you write out, in English, what this method does?
                      • 8. Re: Returning the string from the SimpleDateFormat
                        abillconsl
                            public String convert (Calendar gc)
                             {
                                 String s = convert(gc);
                                 return s;
                             }
                        I don't think this will satisfy your needs though, as explained.
                        • 9. Re: Returning the string from the SimpleDateFormat
                          807588
                          abillconsl wrote:
                              public String convert (Calendar gc)
                          {
                          String s = convert(gc);
                          return s;
                          }
                          I don't think this will satisfy your needs though, as explained.
                          You're right.

                          After looking at the method again, i noticed that the method is incomplete.

                          Sorry guys, i have to go back to it again.

                          You can close this thread if neccessary. Again sorry.
                          • 10. Re: Returning the string from the SimpleDateFormat
                            DrClap
                            LevelSix wrote:
                            DrClap wrote:
                            DrLaszloJamf wrote:
                            No.
                            Face it, Dr, you're being trolled.
                            I'm not trolling.

                            I just don't know how to complete this method.

                            I've been here for a while now and i never once messed about with anyone.
                            Nope. Suppose you were on a construction site and the foreman told you to move a pile of concrete blocks from a truck into the building. What do you suppose would happen if you asked the foreman what a concrete block was, and where the building was, and whether you should drive the truck into the street, and then you tried to pick up the whole pile all at once, and then you asked if you could kick the blocks like footballs? This is what you're doing here. You'd be fired from the construction site within half an hour.
                            • 11. Re: Returning the string from the SimpleDateFormat
                              807588
                              LevelSix wrote:
                              DrLaszloJamf wrote:
                              No.
                              Can you tell me what it is, because i've went through the API and i don't know.
                              Have you looked for a tutorial: [http://java.sun.com/docs/books/tutorial/i18n/format/dateintro.html]
                              • 12. Re: Returning the string from the SimpleDateFormat
                                807588
                                DrLaszloJamf wrote:
                                LevelSix wrote:
                                DrLaszloJamf wrote:
                                No.
                                Can you tell me what it is, because i've went through the API and i don't know.
                                Have you looked for a tutorial: [http://java.sun.com/docs/books/tutorial/i18n/format/dateintro.html]
                                Thanks a lot DrLaszloJamf, this is useful.
                                DrClap wrote:
                                Nope. Suppose you were on a construction site and the foreman told you to move a pile of concrete blocks from a truck into the building. What do you suppose would happen if you asked the foreman what a concrete block was, and where the building was, and whether you should drive the truck into the street, and then you tried to pick up the whole pile all at once, and then you asked if you could kick the blocks like footballs? This is what you're doing here. You'd be fired from the construction site within half an hour.
                                Sir...
                                • 13. Re: Returning the string from the SimpleDateFormat
                                  807588
                                  The problem i have with creating this method is i don't know what to input into the convert method. I'm not sure what the gc should be taking.

                                  I tested by typing in "10/9/2006", it says if found a string, but wants a calendar.

                                  What kind of format is that? Any help with this?
                                  • 14. Re: Returning the string from the SimpleDateFormat
                                    807588
                                    LevelSix wrote:
                                    The problem i have with creating this method is i don't know what to input into the convert method. I'm not sure what the gc should be taking.

                                    I tested by typing in "10/9/2006", it says if found a string, but wants a calendar.

                                    What kind of format is that? Any help with this?
                                    Your method signature is still the following, right?
                                    public String convert (Calendar gc)
                                    What does it take? What does it return? What is it supposed to do?
                                    1 2 Previous Next