• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Recording and looking up dates, when day-wide precision is required
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recording and looking up dates, when day-wide precision is required


  • Subject: Re: Recording and looking up dates, when day-wide precision is required
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Tue, 23 Dec 2008 20:31:17 -0400


On Dec 23, 2008, at 18:08, Lachlan Deck wrote:

One more thing... Reading the posts that David mentioned, I notice there is some mentioning of java.util.Date being converted to and from NSTimestamp. I am not sure why this is mentioned as a problem. AFAIK, both Date and NSTimestamp (which inherits from Date) record the amount of milliseconds that passed from January 1, 1970, 00:00:00 GMT. Conversion should be lossless, no? Or, is this a problem for some other reason?

NSTimestamps understand timezones *only* during construction. From that point on they are strictly UTC. i.e., they do not preserve the timezone from which they were constructed. You'll need another column, as mentioned above, to store that information.


I am not interested in storing time zones. I am only interested in the following:

1. The user inputs a date as text, which gets parsed into a java.util.Date
2. I want to:
a) Parse and store the date
b) Retrieve the date
c) Represent the date across all time zones so that it always appears as the same date (textually) that the user put in. Note that dates will be transmitted to other machines using JavaClient in raw form, and formatted there.


As for preserving exact extra information (time zone of input, and the time of input), this is in this case not required.

In that sense, what I wrote before matters. If I store a date (as in a millisecond offset) that can be described as let's say Dec 21st, 2008. 00:00:00 GMT+0400, this point in time might be represented to end users as up to 2 or 3 different date Strings (the 20th, the 21st and the 22nd), depending on where they are.

As for what Andrew says, that it's tricky displaying a millisecond offset as the same date across all time zones, yes, it is. But, as far as I can see at the moment, a long that represents a point in time that can be described as whichever date with the time of 11:30 GMT should format into the same date String (though obviously not the same time) across all the time zones the users might be in. Well, at least that's my hypothesis, is it wrong?

F

and yes, switching to storing dates textually might be the way to go. A simpler way for sure, and in this case I do not need the other info. Still, I'm interested if the above idea works. As far as I can tell, it should. An argument for using Dates, as opposed to text, is that we might summarize information based on date, and we allow the users to have custom formatters for dates (stored as a preference). Both is easier to handle if I store Dates, and not text.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Recording and looking up dates, when day-wide precision is required
      • From: Lachlan Deck <email@hidden>
    • Re: Recording and looking up dates, when day-wide precision is required
      • From: Ken Anderson <email@hidden>
References: 
 >Recording and looking up dates, when day-wide precision is required (From: Florijan Stamenkovic <email@hidden>)
 >Re: Recording and looking up dates, when day-wide precision is required (From: Lachlan Deck <email@hidden>)
 >Re: Recording and looking up dates, when day-wide precision is required (From: Florijan Stamenkovic <email@hidden>)
 >Re: Recording and looking up dates, when day-wide precision is required (From: Lachlan Deck <email@hidden>)

  • Prev by Date: How to programatically set the undo default stack size to 0?
  • Next by Date: Re: How to programatically set the undo default stack size to 0?
  • Previous by thread: Re: Recording and looking up dates, when day-wide precision is required
  • Next by thread: Re: Recording and looking up dates, when day-wide precision is required
  • Index(es):
    • Date
    • Thread