On Thu, Feb 18, 2016 at 9:16 PM, Stephan Beal <sgbeal at googlemail.com> wrote:

> Okay, i've hit a small stump and i'm looking for a hint without giving it
> away:
>
> January and February 2016:
>
> [stephan at host:~/tmp]$ sqlite3 < cal.sql
>               1  2  3
>   4  5  6  7  8  9 10
>  11 12 13 14 15 16 17
>  18 19 20 21 22 23 24
>  25 26 27 28 29 30 31
>


[stephan at host:~/tmp]$ sqlite3 < cal.sql
---------------------\n              1  2  3
  4  5  6  7  8  9 10
 11 12 13 14 15 16 17
 18 19 20 21 22 23 24
 25 26 27 28 29 30 31
---------------------\n  1  2  3  4  5  6  7
  8  9 10 11 12 13 14
 15 16 17 18 19 20 21
 22 23 24 25 26 27 28
 29

doh! How do i get newlines?

@Jose: good point. %4 would have sufficed for this purpose.

@R. Smith: i'm already storing the month names in a CTE:

...
monthData(name, monthNum, year, days) as (
     select 'Jan', 1, y.year, 31 from years y
     union all
     select 'Feb', 2, y.year,
     28 + (CAST(strftime("%j", y.year||"-12-31") AS INTEGER) % 365)
     from years y union all
     select 'Mar', 3, y.year, 31 from years y union all
     select 'Apr', 4, y.year, 30 from years y union all
     select 'May', 5, y.year, 31 from years y union all
     select 'Jun', 6, y.year, 30 from years y union all
     select 'Jul', 7, y.year, 31 from years y union all
     select 'Aug', 8, y.year, 31 from years y union all
     select 'Sep', 9, y.year, 30 from years y union all
     select 'Oct', 10, y.year, 31 from years y union all
     select 'Nov', 11, y.year, 30 from years y union all
     select 'Dec', 12, y.year, 31 from years y
),


-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

Reply via email to