Re: [sqlite] Conversion string -> date

2008-03-28 Thread Igor Tandetnik
Zbigniew Baniewski <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 28, 2008 at 02:39:23PM -0400, Igor Tandetnik wrote:
>
>> date() function produces a string. You are trying to subtract a
>> number from a string, at which point SQLite converts the string to
>> number ('2008-03-28' becomes 2008) and performs the subtraction
>> (2008 - 14 == 1994).
>
> I don't know the conversion routines details - but shouldn't be more
> proper to convert to "Julian Day" first, and then to make a
> subtraction (when "date involved" has been detected), and - finally -
> to convert back to "Gregorian Day"?

It's just a string. How is SQLite supposed to know this string is 
intended to represent a date?

But of course, if you wanted to perform arithmetic on julian days, you 
can always use julianday() function - just as I showed.

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Conversion string -> date

2008-03-28 Thread Zbigniew Baniewski
On Fri, Mar 28, 2008 at 02:39:23PM -0400, Igor Tandetnik wrote:

> date() function produces a string. You are trying to subtract a number 
> from a string, at which point SQLite converts the string to number 
> ('2008-03-28' becomes 2008) and performs the subtraction (2008 - 14 == 
> 1994).

I don't know the conversion routines details - but shouldn't be more proper
to convert to "Julian Day" first, and then to make a subtraction (when "date
involved" has been detected), and - finally - to convert back to "Gregorian
Day"?

Actually... yes, one can live without that.
-- 
pozdrawiam / regards

Zbigniew Baniewski
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users