Results 1 to 3 of 3
  1. #1
    vagetoanima is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Question [SOLVED] Dynamic String -> Date Handeling

    Hello again,

    I could really use some help on this. I am making a program that reads dates that happen to be stored as Strings in an excel spreadsheet into my program. However I need to store them as some kind of Date object so they can be compared against later. The problem that I am having is, the source data (the String versions of the dates) are not consistent as the company I work for is Global and different regions use different standards for date formating. So I need a catch all to format my dates as MM/dd/yyyy and store them that way when the input data may be M/d/yy, d/mm/yyyy, yyyy/d/mm, yyyy/mm/dd, etc. If any one here has any suggestions, ideas, or could point me in the right direction I would greatly appreciate it. :confused:

    Mr C.

    Edit: Also the input data might contain actually month names/abbreviations not just their number, such as Oct/1/2009 October/1/2009.
    Last edited by vagetoanima; 03-28-2009 at 12:16 AM. Reason: Addition

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    I recommend looking into java.util.Date, and java.text.SimpleDateFormat. That's what these two classes are all about.

  3. #3
    vagetoanima is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default

    Thank you for the help.

    I took a look at SimpleDateFormat and was able to put something together that would work for formatting the dates. Still not as dynamic as I'd like it to be but it is to the point where it works.

    Thank you again.

    Mr. C

Similar Threads

  1. Compare date input to database with current date
    By hungleon88 in forum Advanced Java
    Replies: 2
    Last Post: 11-25-2008, 09:10 AM
  2. Creating a Gregorian Calendar using a Date object gives date - 1
    By prachi_goliwadekar in forum New To Java
    Replies: 1
    Last Post: 05-08-2008, 09:32 PM
  3. Converting Epoch to string Date
    By amyedwards in forum New To Java
    Replies: 3
    Last Post: 12-14-2007, 11:33 PM
  4. String to Date conversion
    By javaplus in forum New To Java
    Replies: 2
    Last Post: 11-06-2007, 08:16 PM
  5. Date as String to TimeStamp
    By ironballs in forum Advanced Java
    Replies: 1
    Last Post: 08-01-2007, 02:43 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
  •