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)

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

Reply via email to