[Lazarus] Google Calendar API TEvent start or _end (TDatetime) question

Michael Van Canneyt michael at freepascal.org
Wed Jun 3 14:51:59 CEST 2020



On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote:

> Hi everyone, I have the following problem. I have a calendar (Italian) to
> sync with Google Calendar. With the following code I can work quite well.
> If today (2020-06-03) I set a new appointment it is saved on google
> calendar on the right day and time, but if for example: always today if I
> set an appointment for December 10, 2020 at 9 am, I find myself there
> appointment set on the right day but at 8 am. (So an hour behind) I think
> it's due to the change between sunlight and daylight. Can anyone explain to
> me how to solve the problem?
>
> Thank you
> XinYiMan
>
>
>
> var
>   start_e  : TEventDateTime;
>   end_e    : TEventDateTime;
>   Entry    : TEvent;
> begin
>            Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId,
> my_id_app);
>
>                     start_e := TEventDateTime.Create();
>                     end_e   := TEventDateTime.Create();
>
>                     start_e.dateTime   := data_appuntamento;
>                     start_e.dateTime   :=
> LocalTimeToUniversal(start_e.dateTime);
>                     start_e.timeZone   := 'Europe/Rome';

If you set the timzeone explicitly, I don't think you must do a LocalTimeToUniversal, 
I think the timezone is then automatically taken into account. As I
understand it you specify the timezone in dateTime or you set it in the
timezone.

Michael.


More information about the lazarus mailing list