Reputation: 979
I am using GMAIL API over REST interface to read mails from gmail server, my problem is when I am using date filter by giving a date as 'after:2014/8/20 before:2014/8/22' then the mails starting from 2014/8/20 12.30 PM onwards are downloaded (ideally it should consider mails from 12.00 AM). Mails from night 12.00 AM till noon 12.30 PM are skipped. I think server is using PST time zone. Can I specify time in the filter? or is there a way to specify time zone so that I get all the mails.
code used:
UsersResource.MessagesResource.ListRequest request = null;
ListMessagesResponse response = null;
request = gmailServiceObj.Users.Messages.List(userEmail);
String query = "after:" + FromDate.Date.ToString("yyyy/M/dd") + " before:" + ToDate.Date.ToString("yyyy/M/dd") + " label:" + LabelID;
request.Q = query;
Thanks, Haseena
Upvotes: 9
Views: 6050
Reputation: 12673
It does appear that the timezone being used when processing these queries is always PST. There is currently no way to specify the timezone in the request, or have it use the timezone of the account. I'll follow up with the engineering team to come up with a resolution.
Upvotes: 3
Reputation: 7159
The behavior of the API in this regard should be the same as the web UI, can you verify if that's not the case? The search query params are listed here: https://support.google.com/mail/answer/7190?hl=en
It seems odd that it wouldn't deliver emails between 12:00AM and 12:30AM, what timezone is your client in? What's the timezone preference set to in the Gmail web interface for the user? You could try changing that preference and see if it helps? If not, one workaround I can think of is to have the filter from the day before and do the filtering client-side, as ugly as that is... :-/
Upvotes: 2