SQLite with strftime('%w', ...) not giving expected results -
i need determine if particular date sunday, find date following sunday. using strftime function below check day of week, case statement not evaluate properly. example 2014-03-09 (iso format) sunday. have expected following sqlite case statement evaluate 7.
select strftime('%w', date('2014-03-09')) , case when strftime('%w', date('2014-03-09')) = 0 7 else 0 end
generates
0|0 <-- why isn't 0|7?
what missing?
my version of sqlite is
sqlite 3.7.11 2012-03-20 11:35:50 00bb9c9ce4f465e6ac321ced2a9d0062dc364669
in query, you're comparing string integer, evaluate false. try comparing string:
case when strftime('%w', date('2014-03-09')) = '0'
Comments
Post a Comment