Introducing how to execute on the latest n days of emails (timestamp) in Google Apps Script (GAS).
What I was thinking while working with GAS was that fetching and processing the latest few emails would eventually run out of emails, accidents could happen, and I was somewhat dissatisfied with the mysterious specification that the processing unit is not individual emails but threads, which are collections of one or more emails.
So, thinking about what to do, I thought limiting to emails from the latest 1 day would be good.
GmailApp.search( "newer_than:1d something term" , 0, 3)
This works. h, d, m, y can now be used.
Operator reference:
Search operators you can use with Gmail - Gmail Help
If you want to specify by absolute time or want to specify a range, you can use after:2004/04/16 and before:.
It’s a digression or rather an unrelated topic, but the operator dinner AROUND 2 friday is convenient. It catches sentences like “How about dinner on Friday?” but doesn’t catch “Friday was fun. By the way (omitted) let’s go to dinner again sometime.” Though I’m not sure if it works for Japanese.