Results 1 to 5 of 5
  1. #1
    azazel is offline Member
    Join Date
    Nov 2010
    Posts
    3
    Rep Power
    0

    Default Date represented by an integer?

    I am making a program that reads some text files and takes some input from it. Among them are some dates and some values for each of those dates.

    But the program which generated the text files seems to have had an error in it, because some of the dates are integers instead of the expected dd/mm/yyyy format.

    Are there an integer value for each date so that I might convert it to a normal date? Or perhaphs it could be some integer value for a String?

    Example of some of the error dates:
    -563928110
    -526123989
    -482744773
    -562411837
    I think they are supposed to be dates between February and April of 2010.

    Can anyone see a connection, or is this a major screw up from the original program?

  2. #2
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    Are these Strings obtained from java.util.Date objects? If so, I think that Date is internally represented as a long value that can be obtained by calling getTime() on the Date object. Perhaps you need to debug the code that produced that file to see how the data was generated and just what it represents.

  3. #3
    azazel is offline Member
    Join Date
    Nov 2010
    Posts
    3
    Rep Power
    0

    Default

    Thanks for the reply.
    That's the problem. I don't have access to the code that made the files/dates. So I am trying to see if there is a way to find out what they represent by the number alone.

  4. #4
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    I don't see any decipherable pattern in them. I've tried converting them directly to dates (which lands them some time in 1969), and making them subtracted from the unix epoch + 2^32 secs (which is the ending date for any 32-bit timing scheme) and a few other nifty things but I can find no way that they relate to 2010.

    PS: I also tried, as an experiment, fooling SimpleDateFormat into outputting a negative integer with no success. My guess is that the creator did not use standard Java classes to generate the output, but instead his own class, which may not have been designed to handle negative integers. Then, when it was faced with such a number, it went ka-blewie and gave some arbitrary integer output. It's really hard to tell without the original dates or the source code.

    (Also, off-topic, did you used to play C&C Renegade?)
    Last edited by Zack; 11-08-2010 at 06:26 AM.

  5. #5
    azazel is offline Member
    Join Date
    Nov 2010
    Posts
    3
    Rep Power
    0

    Default

    Thanks for trying. There are quite a few files with this error. I looked at alot of the others as well. All of them are large integers, but some are positive and some negative. It must be a major screw up in the original program because all of the numbers seems to be unique, but some of the dates are supposed to be the same.

    I will try to contact the author, but doubt I will get hold off him. :mad:

    (off-topic: nope :) )

Similar Threads

  1. Replies: 4
    Last Post: 08-01-2010, 10:25 AM
  2. convert unsigned integer to signed integer in java?
    By diskhub in forum New To Java
    Replies: 6
    Last Post: 05-17-2010, 01:50 AM
  3. Compare date input to database with current date
    By hungleon88 in forum Advanced Java
    Replies: 2
    Last Post: 11-25-2008, 09:10 AM
  4. 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
  5. Replies: 1
    Last Post: 08-01-2007, 09:55 AM

Posting Permissions

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