
How can I search Google Gmail messages within a date range?I have a ton of email in my Gmail archive, and sometimes need to dig through older email. Problem is, if I do a search, it shows me all the most recent matches first when what I really want to do is, say, search for messages more than a year old, or 12-18 months ago or similar. Is there any way to do a more sophisticated search than just by keyword? I'm a big fan of Google's Gmail service, and have found that experimentation is a great thing in terms of its search, just as poking around and trying different things in Google's main search system can real all sorts of useful capabilities, including the ability to convert measurement and weight units and the ability to solve even fairly complicated formulas. In Gmail, as with many Google properties, the real secret is to pay attention to the small print (does that sound like something your Dad might have told you when you were younger? :-) For example, when you're in Gmail, here's what you see in the search area: Look closely. See the link "Show search options"? Click it: ![]() That's pretty interesting, isn't it? :-) Now let's poke around a bit. If I do a search for "contract" on email that's between one and two years old (which is done, rather awkwardly, as being within six months of 18 months ago), the resultant URL is: https://mail.google.com/mail/#advanced-search/subset=all&has=contract&within=6m&date=18+months+ago
So we can see that Gmail uses a different sort of URL notation for advanced searches with "#advanced-search/subset=all". The keyword is in the "has=" value, and then there's a "date=" and a "within=". The question is, can we use those as predicates directly in a search? I'll try it, searching for "contract within:6m date:01/01/2008". The result? Zero. Ah, well, okay, so that doesn't work. But what does? Turns out that with a big of digging, Google has an advanced search help page that details the following long list of predicates:
There are many more entries (see the original Google article) but these are the key ones that most power users are going to focus upon. This also gives us the tools we need to do the search we really want to do: "contract before:2008/06/01 after:2007/06/01" That, finally, gives us all email that contains the word "contract" and was sent or received between June 1, 2007 and June 1, 2008. All messages more than a year old? Just use "before:" and follow it with the previous year and current month and day. As I write this, it'd be "2008/06/21". Sometimes experimentation fails, as we saw with my first stab, but exploring the help menus and everything else definitely reveals that the Gmail search system has quite a bit more power than is immediately obvious, and quite a bit more power than even you get with the 'advanced search' pane.
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon
Categorized:
Computer and Internet Basics
(Article 8948)
Tagged: email archives, gmail, gmail searching, google mail Previous: How do I work with Voice Memos on my Apple iPhone? Next: Can I use Apple Time Machine to restore to a new MacBook? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.
Rather amazingly, there are no comments on this article yet.
I have a lot to say, but ...
I do have a comment, now that you mention it!
|
![]()
Search
Find just the answers you seek from among our 2300+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Industry News and Trade Shows Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Book Links
|