如何使用日期时间GMAIL API查询过滤器 [英] how to use GMAIL API query filter for datetime

查看:270
本文介绍了如何使用日期时间GMAIL API查询过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GMAIL API通过REST接口读取来自Gmail服务器的邮件,我的问题是,当我使用日期过滤器通过给一个日期为后:2014年8月20日之前:2014年8月22日,那么从2014年8月20日下午12:30起​​开始邮件都下载(理想情况下,应考虑从12.00邮件)。从夜间12.00到中午下午12:30邮件被跳过。我认为服务器使用PST时区。
我可以在过滤器中指定时间?使用或者是有指定的时区,这样我得到的所有邮件的方式

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.

代码:

    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;             



谢谢,
Haseena

Thanks, Haseena

推荐答案

它似乎正在使用的时区时,处理这些查询始终是PST。目前还没有办法指定在请求的时区,还是有它使用的帐户的时区。我将与工程团队要拿出一个解决跟进。

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.

这篇关于如何使用日期时间GMAIL API查询过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆