2016-01-29 16:23 GMT+01:00 Igor Tandetnik <igor at tandetnik.org>:

> On 1/29/2016 2:39 AM, Jean-Christophe Deschamps wrote:
>
>> select cast(julianday('now') as int)
>>
>> should do what you want.
>>
>
> Note that the fractional part in Julian day represents time-of-day since
> noon, not since midnight. The expression above will give different values
> at 11am and 1pm (UTC) of the same day, and the same value at 11pm and 1am
> of the same night. You would probably want cast(julianday('now')-0.5 as
> int) or perhaps cast(julianday('now', 'localtime')-0.5 as int)
>

?Yeah, I saw that. I went back to:
    date    TEXT NOT NULL DEFAULT CURRENT_DATE
?



> Personally, I prefer cast(strftime('%Y%m%d', 'now') as int) - in other
> words, storing calendar dates as integers like 20160129.
>

?That is a nice one. Maybe I'll change it again. ;-)

-- 
Cecil Westerhof

Reply via email to