Solved

MPXJ - Can I change date format using the MPXJ object library?  How?

Posted on 2004-10-28
531 Views
Last Modified: 2008-01-09
Hi, experts:

I am successfully reading an MPP file using MPXJ.  However, date formats are sometimes returning dd/mm/yyyy and other times returning mm/dd/yyyy.  I can see the format in my Eclipse object browser but I'm having difficulty getting to it in my code.  Can anyone offer the code to get to the MPXDateFormat?

      MPXDateFormat df = new MPXDateFormat();    //MPXDateFormat cannot be resolved or is not a type

I'm giving this question high points because I need an answer as fast as possible.  I do apologize for the rediculous constant crisis mode that my management produces.  At least you don't have to work here.

Thanks in advance for your help,
Patricia
0
Question by:pdlarue
    5 Comments
     
    LVL 37

    Expert Comment

    by:zzynx
    Are you talking about
         input: a String containing dd/mm/yyyy or mm/dd/yyyy
         output: a java.util.Date object

    ?
    Then you need to use SimpleDateFormat and its function parse()
    0
     
    LVL 37

    Accepted Solution

    by:
    Or do you mean this?

    MPXDateFormat df = new MPXDateFormat();
    df.applyPattern("dd/MM/yyyy");  // or the other pattern
    MPXDate d = df.parse(theStringContainingTheDate);
    0
     
    LVL 37

    Expert Comment

    by:zzynx
    >> I need an answer as fast as possible.
    Not that fast apparently ;°)
    Sorry, going offline. Good luck.
    0
     

    Author Comment

    by:pdlarue
    Hey, zzynx:

    Yes, after struggling with MPXDateFormat (couldn't figure out how to make it visible to me) I used the SimpleDateFormat in java.util.Date.  Now, I'm having trouble with the month being zero based (January comes back '00').  I'll figure it out soon.  If you haven't guessed yet, I'm not new to objects but I am new to Java.  I have to keep coming to you experts instead of researching it myself, because my manager is crazy.

    Thanks again,
    Patricia
    0
     
    LVL 37

    Expert Comment

    by:zzynx
    Thanks

    >> Now, I'm having trouble with the month being zero based (January comes back '00').
    Indeed. Stupid design.
    >> I have to keep coming to you experts instead of researching it myself,
    No problem ;°)
    >> because my manager is crazy.
    Like most :°D
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Course: JavaScript Coding - Massive 12-Part Bundle

    Regardless of your programming skill level, you'll go from basics to advanced concepts in a vast array of JavaScript subjects including Sammy.js, Agility.js, Ember.js, Node.js, jQuery, AJAX, Extjs, AngularJS, Knockout.js, and JSON.

    1. Package the applet into a JAR file. The applet must be in a JAR file before a certificate can be attached to it. Use the jar JDK utility. If the applet was previously referenced with the help of a codebase attribute in  tag, replace the codebase …
    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now