How to use the GMAIL API request filter for datetime

I use the GMAIL API through the REST interface to read emails from the gmail server, my problem is that I use a date filter, giving the date "after: 2014/8/20 to: 2014/8/22", then mail starting from 2014/8/20. 12:30 and later are loaded (ideally, they should consider letters from 12.00). Letters from the evening from 12.00 to 12.00 are missed. I think the server uses the PST time zone. Can I specify the time in the filter? or is there a way to specify the time zone so that I receive all the letters.

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

+4
source share
2 answers

It seems that the time zone used to process these requests is always PST. There is currently no way to specify the time zone in the request or use the time zone for the account. I will continue to work with the development team to come up with a resolution.

+2
source

The behavior of the API in this regard should be the same as the web interface, can you check, right? Search query parameters are listed here: https://support.google.com/mail/answer/7190?hl=en

It seems strange that he will not deliver emails from 12:00 to 12:30, in what time zone is your client? What time zone setting is set in the Gmail web interface for the user? You can try changing this preference and see if it helps? If not, then a workaround that I can think of is to have a filter from the previous day and filtering on the client side, as ugly as this ...: - /

+1
source

Source: https://habr.com/ru/post/1236788/


All Articles