db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Enyedi <robert.eny...@intland.com>
Subject Re: MySQL TO_DAYS() emulation in Derby
Date Fri, 15 Sep 2006 13:02:45 GMT

As far as I know, year 0 in MySQL is actually 1 AD. However, it doesn't 
necessarily matter when that year is when you have the comparability of 
the results.

What matters that this function in combination with its reverse, 
FROM_DAYS, allows easily for one to compute things like:
- are both timestamps in the same day? TO_DAYS(tstamp1) = TO_DAYS(tstamp2)
- how many days are between the two dates? TO_DAYS(date1) - TO_DAYS(date2)
- what is the date if one adds X days to a specified date? 

I'm not specifically in love with this function either, but what other 
alternatives does Derby offer to make these computations?


Michael Segel wrote:
> On Friday 15 September 2006 7:15 am, Robert Enyedi wrote:
>> The TO_DAYS() function returns the number of days since year 0. Did
>> someone successfully port this functionality to Derby? Constructing a
>> Java function for this is not as straightforward as it looks.
>> Regards,
>> Robert
> Why?
> When was year 0?
> Just because you see a function in MySQL, doesn't mean that its a good thing 
> or that it has value.
> Everytime you "add" a function, you're increasing the footprint of Derby.
> To some this isn't an issue. To others who wish to embed Derby within an 
> Applet/Servlet/whatever... This is not a good thing.

View raw message