Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / SQLite [игнор отключен] [закрыт для гостей] / Календарик / 1 сообщений из 1, страница 1 из 1
23.08.2011, 00:30
    #37406985
maximand
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Календарик
Сваял вот календарик. Может пригодится кому или более изящное решение кто предложит.

Код: plaintext
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.
32.
33.
34.
35.
36.
37.
38.
39.
40.
    SELECT
    case when  1  - strftime('%w','now','start of month','localtime') < 0  then '' else strftime('%d','now','start of month','localtime','+1 day','-'||strftime('%w','now','start of month','localtime')||' day') end as "пн"
    ,case when  2  - strftime('%w','now','start of month','localtime')< 0  then '' else strftime('%d','now','start of month','localtime','+2 day','-'||strftime('%w','now','start of month','localtime')||' day') end as "вт"
    ,case when  3  - strftime('%w','now','start of month','localtime')< 0  then '' else strftime('%d','now','start of month','localtime','+3 day','-'||strftime('%w','now','start of month','localtime')||' day') end as "ср"
    ,case when  4  - strftime('%w','now','start of month','localtime')< 0  then '' else strftime('%d','now','start of month','localtime','+4 day','-'||strftime('%w','now','start of month','localtime')||' day') end as "чт"
    ,case when  5  - strftime('%w','now','start of month','localtime')< 0  then '' else strftime('%d','now','start of month','localtime','+5 day' ,'-'||strftime('%w','now','start of month','localtime')||' day') end as "пт"
    ,case when  6  - strftime('%w','now','start of month','localtime')< 0  then '' else strftime('%d','now','start of month','localtime','+6 day','-'||strftime('%w','now','start of month','localtime')||' day') end as "сб"
    ,case when  7  - strftime('%w','now','start of month','localtime')< 0  then '' else strftime('%d','now','start of month','localtime','+7 day','-'||strftime('%w','now','start of month','localtime')||' day') end as "вс"
    union all SELECT
    strftime('%d','now','start of month','localtime','+8 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+9 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+10 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+11 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+12 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+13 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+14 day','-'||strftime('%w','now','start of month','localtime')||' day')
    union all SELECT
    strftime('%d','now','start of month','localtime','+15 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+16 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+17 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+18 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+19 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+20 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+21 day','-'||strftime('%w','now','start of month','localtime')||' day')
    union all SELECT
    strftime('%d','now','start of month','localtime','+22 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+23 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+24 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+25 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+26 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+27 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,strftime('%d','now','start of month','localtime','+28 day','-'||strftime('%w','now','start of month','localtime')||' day')
    union all SELECT
    strftime('%d','now','start of month','localtime','+29 day','-'||strftime('%w','now','start of month','localtime')||' day')
    ,case when  case strftime('%w','now','start of month','+1 month','-1 day','localtime') when '0' then '7' else strftime('%w','now','start of month','+1 month','-1 day','localtime') end <'2'  then  ''  else strftime('%d','now','start of month','localtime','+30 day','-'||strftime('%w','now','start of month','localtime')||' day')  end
    ,case when  case strftime('%w','now','start of month','+1 month','-1 day','localtime') when '0' then '7' else strftime('%w','now','start of month','+1 month','-1 day','localtime') end <'3'  then  '' else strftime('%d','now','start of month','localtime','+31 day','-'||strftime('%w','now','start of month','localtime')||' day')  end
    ,case when  case strftime('%w','now','start of month','+1 month','-1 day','localtime') when '0' then '7' else strftime('%w','now','start of month','+1 month','-1 day','localtime') end <'4'  then  ''  else strftime('%d','now','start of month','localtime','+32 day','-'||strftime('%w','now','start of month','localtime')||' day')  end
    ,case when  case strftime('%w','now','start of month','+1 month','-1 day','localtime') when '0' then '7' else strftime('%w','now','start of month','+1 month','-1 day','localtime') end <'5'  then  '' else strftime('%d','now','start of month','localtime','+33 day','-'||strftime('%w','now','start of month','localtime')||' day')  end
    ,case when  case strftime('%w','now','start of month','+1 month','-1 day','localtime') when '0' then '7' else strftime('%w','now','start of month','+1 month','-1 day','localtime') end <'6'  then  ''  else strftime('%d','now','start of month','localtime','+34 day','-'||strftime('%w','now','start of month','localtime')||' day')  end
    ,case when  case strftime('%w','now','start of month','+1 month','-1 day','localtime') when '0' then '7' else strftime('%w','now','start of month','+1 month','-1 day','localtime') end <'7'  then  ''  else strftime('%d','now','start of month','localtime','+35 day','-'||strftime('%w','now','start of month','localtime')||' day')  end
    where  not(strftime('%d','now','start of month','+1 month','-1 day','localtime') ='28' and strftime('%w','now','start of month','localtime') ='1')
...
Рейтинг: 0 / 0
Форумы / SQLite [игнор отключен] [закрыт для гостей] / Календарик / 1 сообщений из 1, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]