【问题标题】:Google Birthday Calendar Wrong Year谷歌生日日历错误的年份
【发布时间】:2018-06-29 10:57:12
【问题描述】:

我在获取谷歌生日日历时遇到问题。我在谷歌生日日历上弄错了年份。

例如: 在我的谷歌联系人中,我有联系人姓名 - 迪帕克,他的生日 - 19/04/1990。所以这个联系人生日显示在谷歌生日日历中。当我获取谷歌生日日历时,我得到的日期类似于 2017-04-19、2018-04-19、2019-04-19。如何从谷歌生日日历中获取联系人确切的生日?

来自 Google 日历 API 的响应

[0] => Array
    (
        [kind] => calendar#event
        [etag] => "3060534890000000"
        [id] => 2017_BIRTHDAY_4a7a6b868dd53910
        [status] => confirmed
        [htmlLink] => https://www.google.com/calendar/event?eid=MjAxN19CSVJUSERBWV80YTdhNmI4NjhkZDUzOTEwICNjb250YWN0c0B2
        [created] => 2018-06-29T10:17:25.000Z
        [updated] => 2018-06-29T10:17:25.000Z
        [summary] => Deepak's birthday
        [description] => This is Deepak's birthday!
        [creator] => Array
            (
                [email] => #contacts@group.v.calendar.google.com
                [displayName] => Contacts
                [self] => 1
            )

        [organizer] => Array
            (
                [email] => #contacts@group.v.calendar.google.com
                [displayName] => Contacts
                [self] => 1
            )

        [start] => Array
            (
                [date] => 2017-06-30
            )

        [end] => Array
            (
                [date] => 2017-07-01
            )

        [visibility] => public
        [iCalUID] => 2017_BIRTHDAY_4a7a6b868dd53910@google.com
        [sequence] => 0
        [gadget] => Array
            (
                [iconLink] => https://calendar.google.com/googlecalendar/images/cake.gif
                [preferences] => Array
                    (
                        [goo.contactsGivenName] => Deepak
                        [goo.contactsEventType] => BIRTHDAY
                        [goo.contactsFullName] => Deepak
                        [goo.isGPlusUser] => false
                        [goo.contactsContactId] => 4a7a6b868dd53910
                        [goo.contactsIsMyContact] => true
                    )

            )

        [reminders] => Array
            (
                [useDefault] => 1
            )

    )


[1] => Array
    (
        [kind] => calendar#event
        [etag] => "3060534890000000"
        [id] => 2018_BIRTHDAY_4a7a6b868dd53910
        [status] => confirmed
        [htmlLink] => https://www.google.com/calendar/event?eid=MjAxOF9CSVJUSERBWV80YTdhNmI4NjhkZDUzOTEwICNjb250YWN0c0B2
        [created] => 2018-06-29T10:17:25.000Z
        [updated] => 2018-06-29T10:17:25.000Z
        [summary] => Deepak's birthday
        [description] => This is Deepak's birthday!
        [creator] => Array
            (
                [email] => #contacts@group.v.calendar.google.com
                [displayName] => Contacts
                [self] => 1
            )

        [organizer] => Array
            (
                [email] => #contacts@group.v.calendar.google.com
                [displayName] => Contacts
                [self] => 1
            )

        [start] => Array
            (
                [date] => 2018-06-30
            )

        [end] => Array
            (
                [date] => 2018-07-01
            )

        [visibility] => public
        [iCalUID] => 2018_BIRTHDAY_4a7a6b868dd53910@google.com
        [sequence] => 0
        [gadget] => Array
            (
                [iconLink] => https://calendar.google.com/googlecalendar/images/cake.gif
                [preferences] => Array
                    (
                        [goo.contactsGivenName] => Deepak
                        [goo.contactsEventType] => BIRTHDAY
                        [goo.contactsFullName] => Deepak
                        [goo.isGPlusUser] => false
                        [goo.contactsContactId] => 4a7a6b868dd53910
                        [goo.contactsIsMyContact] => true
                    )

            )

        [reminders] => Array
            (
                [useDefault] => 1
            )

    )

[2] => Array
(
    [kind] => calendar#event
    [etag] => "3060534890000000"
    [id] => 2019_BIRTHDAY_4a7a6b868dd53910
    [status] => confirmed
    [htmlLink] => https://www.google.com/calendar/event?eid=MjAxOV9CSVJUSERBWV80YTdhNmI4NjhkZDUzOTEwICNjb250YWN0c0B2
    [created] => 2018-06-29T10:17:25.000Z
    [updated] => 2018-06-29T10:17:25.000Z
    [summary] => Deepak's birthday
    [description] => This is Deepak's birthday!
    [creator] => Array
        (
            [email] => #contacts@group.v.calendar.google.com
            [displayName] => Contacts
            [self] => 1
        )

    [organizer] => Array
        (
            [email] => #contacts@group.v.calendar.google.com
            [displayName] => Contacts
            [self] => 1
        )

    [start] => Array
        (
            [date] => 2019-06-30
        )

    [end] => Array
        (
            [date] => 2019-07-01
        )

    [visibility] => public
    [iCalUID] => 2019_BIRTHDAY_4a7a6b868dd53910@google.com
    [sequence] => 0
    [gadget] => Array
        (
            [iconLink] => https://calendar.google.com/googlecalendar/images/cake.gif
            [preferences] => Array
                (
                    [goo.contactsGivenName] => Deepak
                    [goo.contactsEventType] => BIRTHDAY
                    [goo.contactsFullName] => Deepak
                    [goo.isGPlusUser] => false
                    [goo.contactsContactId] => 4a7a6b868dd53910
                    [goo.contactsIsMyContact] => true
                )

        )

    [reminders] => Array
        (
            [useDefault] => 1
        )

)

【问题讨论】:

  • 日历不包含原始出生日期,它包含每个年度生日的提醒。数据没有任何“错误”,只是您找错地方了。

标签: google-api google-contacts-api google-calendar-api google-people-api


【解决方案1】:

Google 日历和 Google 通讯录是两个不同的东西。出生日期和生日之间也有区别。前者只发生一次,后者一年发生一次。

例如:在我的 Google 联系人中,我的联系人姓名 - Deepak,其生日 - 19/04/1990。

这是您在通讯录中为该用户输入的条目。它是用户的出生日期。

所以这个联系人生日显示在谷歌生日日历中。当我获取谷歌生日日历时,我得到的日期类似于 2017-04-19、2018-04-19、2019-04-19。

Google 日历生日日历会为您提供每年的用户生日活动。这样你就不会忘记送花。

我如何从谷歌生日日历中获取联系人确切的生日?

如果您只想从您的 Google 联系人中获取数据,您应该直接通过 google contacts api

【讨论】:

    猜你喜欢
    • 2012-06-05
    • 1970-01-01
    • 1970-01-01
    • 2015-09-01
    • 2013-08-11
    • 1970-01-01
    • 2019-09-08
    • 2016-12-14
    • 1970-01-01
    相关资源
    最近更新 更多