Return date as year

I wrote this little search query:

 User.where("strftime('%Y', birthday) = ?", 1994)

But somehow i get no search resuts although i now that i have several users with their birthday in 1994. In the Users Table birthday is defined as date

Now i have two ideas how i could solve my problem:

1.I could check what the result of "strftime('%Y', birthday) is for a specific user or the whole user collection. But i dont know the expression! Maybe you know the expression?

2.You know what i did wrong and you have an answer?



In Rails you can write the query like:

User.where("birthday BETWEEN '?-01-01' AND '?-12-31'",1994,1994)

See this post for why this kind of format is good performance-wise when compared to something that uses "YEAR": SQL query where() date's year is $year.

Need Your Help

Can you use multiple VaryByCustom parameters when caching a user control? caching

I've been trying this a couple of different ways, but it's not working for some reason. Is it even possible?

Backbone: Adding a model to Collection and render a View

javascript backbone.js backbone-views backbone-routing

I'm building a simple Backbone app where I mainly have a view with a list of books (book name + cover image) and another view where I want to add new books to the list.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.