Google生日日历错误年份

时间:2018-06-29 10:57:12

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

我在获取Google生日日历时遇到问题。我在Google生日日历中输入了错误的年份。

例如: 在我的Google联系人中,我的联系人姓名-Deepak的生日-1990年4月19日。因此,此联系人生日显示在Google生日日历中。当我获取Google生日日历时,我正在获取日期,如2017-04-19、2018-04-19、2019-04-19。我该如何从Google生日日历中获取确切的生日年份?

来自Google Calendar 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
        )

)

1 个答案:

答案 0 :(得分:2)

Google日历和Google联系人是两回事。出生日期和生日之间也有区别。前者仅发生一次,后者每年发生一次。

  

例如:在我的Google联系人中,我有一个联系人姓名-Deepak,生日-1990年4月19日。

这是您在该用户的地址簿中的条目。用户的出生日期。

  

因此此联系人生日显示在Google生日日历中。当我获取Google生日日历时,我正在获取日期,如2017-04-19、2018-04-19、2019-04-19。

Google日历的生日日历为您提供了该年用户生日每年的事件。这样您就不会忘记送花。

  

如何从Google生日日历中获取确切的生日年份?

如果您只想从Google通讯录中获取数据,则应该直接通过google contacts api