×

Discussion Board

Results 1 to 3 of 3

Thread: Current Date

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    42

    Current Date

    Hey guys

    I have trying to persist an object with the current date. So that later I can lookup all of the persisted objects on a specific date. But I do not know how I should do this.

    I am using the Floggy framework, but that is irrelevant. I want to have a field in the object I am persisting for this. But I not sure if I should save Date or Calender in the object.

    Date d = new Date();

    or

    Calender c = Calender.getInstance();

    Wich would be the best for me to use in this situation?

    Also, I have another persistable object of Person. Which has a DOB object. Should that be Date or Calendar? Again I am not sure. I would want to calculate the age of the user based on this.

    I hope I make sense.

    Thanks for any feedback.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Current Date

    Ultimately, all time-and-date information is represented as a long, just as returned by System.currentTimeMillis(). Each Date object contains a long, which you can access by Data.getTime(). Just save the long, as this is all the information you need.

    Graham.

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    42

    Re: Current Date

    Ok, thanks for the info

Similar Threads

  1. current date? today's date?
    By mango7 in forum Symbian
    Replies: 3
    Last Post: 2008-10-30, 06:45
  2. Error in packaging process :(
    By a-eqla3 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2008-07-24, 20:33

Posting Permissions

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