Saul Farber wrote:
>> About date.. Saul, is calendar really needed? I understand the binding 
>> should 
>> be either Date or javax.sql.TimeStamp and Calendar provides just a proper 
>> way 
>> to deal with dates, but its not a data object itself?
>>
>>     
> Two things:
>
> 1) calendar (confusingly) *is* a data object itself.  It's a data object
> with a current date, time *and* calendar rules representation.
>
> 2) do we need to use calendar?
> I guess I'm less sure about that one.  I think calendar is used because
> that's what SDE requires internally:
>
> http://edndoc.esri.com/arcsde/9.2/api/japi/docs/com/esri/sde/sdk/client/SeDate.html
>
> And also what SDE returns from a Date column in the db:
>
> http://edndoc.esri.com/arcsde/9.2/api/japi/docs/com/esri/sde/sdk/client/SeRow.html#getTime(int)
>
>
> My preference would be to continue to use Calendar, unless there's a
> compelling reason not to do so.  Let me know what you guys find out.
>   
I have found a *bug* with SeDate; see the original email for the 
details. The Calendar.toDate() function is based on an internal long 
timestamp measured in milliseconds.
- a new Calendar is based on the current time & locale
- calendar.set( ....... ) will set the fields you care about (YEAR, 
MONTH, DAY, HOUR, SECOND, .... )
- if you set( YEAR, MONTH, DAY, 0, 0, 0) as in the TestData the final 
"milli-seconds" field still gets whatever bytes are left over from "the 
current time"
- Calendar does not care about the milli-seconds, but Calendar.getDate() 
will take them into account .... so the test case is broken! The two 
Date's we get back are different ...

Jody

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to