Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: DATE

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default DATE

    Date/Time Formatter
    Write a Java program that is able to receive input in a particular given date pattern. The program will then parse
    the input and print the requested output.
    Input:
    1. The first command line argument to the program is the input, provided by the user.
    2. The second command line argument to the program is the date format/pattern, provided by the user.
    Patterns can be provided using two ways:
    1. Valid date patterns are specified here. See the Examples section of the above link for more info.
    2. If a pattern begins with the letter “*”, convert and print the current time/date based on the Shamsi
    calendar!
    Output:
    Program will then display the following values individually on the command prompt using the following format:
    Year: <year>
    Month: <month>
    Month Name: <name-of-the-month>
    Day: <day>
    Day Name: <day-name>
    Day of year: <what of the day of the year is this?
    > Hour: <hour>
    Minute: <minute>
    Second: <second>
    Exceptions:
    The following exceptions should be thrown and caught by the program internally:
    WayTooOldYearException: If the input year is less than 1900
    PastUserBedTimeException: If the input time is greater than 10:55pm.
    All other error conditions need to be accounted for and appropriate error messages must be displayed.
    OOP:
    Use OOP principals effectively, using the following rules:
    1. Your program must contain a Main class that hosts the main() method.
    2. You should provide different implementations and extensions of the public interface
    IDateTimeFormatter, which includes the following and only method in its body:
    DateTimeObject parseDateTime(final String value);
    3. The DateTimeObject is a class that encapsulates the parsed input value in itself, and exposes various
    methods for accessing the input year, month, hour, etc.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,163
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: DATE

    How is the program coding progressing? Do you have any specific problems or questions about your code? Please post the code (in code tags) and your questions.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: DATE

    hmmm, i need some hint
    i don't have any idea
    or do you have any code like this question that can help me

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,163
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: DATE

    The assignment gives you ideas about how to define the classes.
    Start with the Main class and the DateTimeObject class.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: DATE

    can you tell me if this link can help me or not ?
    Is it like my question?
    Day for the given Date in Java

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,163
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: DATE

    Sorry, I'll let you look and decide. I won't help you copy someone else's code.
    If you have questions about your code, copy the code here and ask your questions about your problems.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Nov 2012
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: DATE

    oh no.
    I don't want to copy someone else code.
    If i want do this, why should i ask about hint.
    I just want to know if this code can give me that hint or not.
    thanks for your honesty
    anis

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,163
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: DATE

    If you have questions about your code, post the code and the questions.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Java Date Format in Date Object
    By Ashr Raza in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 13th, 2012, 10:47 AM
  2. Parsing a full date/time/timezone date to "yyyy-MM-dd"
    By Occidentally in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 4th, 2012, 08:57 AM
  3. Replies: 1
    Last Post: July 22nd, 2011, 07:08 AM
  4. Date help
    By banny7 in forum AWT / Java Swing
    Replies: 4
    Last Post: July 18th, 2011, 10:41 AM
  5. same date should entered in another date field
    By shashib09 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: July 14th, 2011, 08:42 AM