<div dir="ltr"><div>if I change my code in this mode, and change Google Calendar configuration, with Greenwich meridian, I see correct result on Google Calendar. But I'm not on Greenwich meridian.</div><div><br></div><div><div><br></div><div>I edited the demo calendar. I added a button and inside I put the
following code. <br></div><div><br></div><div>procedure TMainForm.Button1Click(Sender: TObject);</div>var<br> Entry : TEvent;<br> Insert : TEvent;<br> start_e : TEventDateTime;<br> end_e : TEventDateTime;<br>begin<br> if LBCalendars.ItemIndex<0 then<br> Exit;<span class="gmail-im"><br><br> start_e := TEventDateTime.Create();<br> end_e := TEventDateTime.Create();<br><br></span> start_e.dateTime := EncodeDateTime(2020,6,3,19,0,0,0);<br> start_e.timeZone := 'Europe/London';<br> end_e.dateTime := IncHour(start_e.dateTime,2);<br> end_e.timeZone := 'Europe/London';<br><br> Entry := TEvent.Create();<br> Entry.summary := 'My test';<br> Entry.description := 'My test';<br> Entry.location := 'My location';<span class="gmail-im"><br> Entry.start := start_e;<br> Entry._end := end_e;<br><br></span> Entry.guestsCanInviteOthers := false;<br> Entry.guestsCanSeeOtherGuests := false;<br><br> Entry.colorId := '';<br><br> Insert := FCalendarAPI.EventsResource.Insert(FCurrentCalendar.id,Entry);<br><br> SaveRefreshToken;<br><br><br> Entry.Free;<br> Entry:=nil;<br><br> ShowMessage('Insert ' + Insert.id);<br><br> Insert.Free;<br> Insert:=nil;<br>end;</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mer 3 giu 2020 alle ore 15:59 Michael Van Canneyt <<a href="mailto:michael@freepascal.org">michael@freepascal.org</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On Wed, 3 Jun 2020, Francesco Sammarco wrote:<br>
<br>
> sorry and how do I set the date and time of the apartment ?!<br>
<br>
I would think this is sufficient:<br>
<br>
Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, my_id_app);<br>
start_e := TEventDateTime.Create();<br>
end_e := TEventDateTime.Create();<br>
start_e.dateTime := data_appuntamento;<br>
start_e.timeZone := 'Europe/Rome';<br>
<br>
Michael.<br>
<br>
><br>
> Il mer 3 giu 2020, 15:55 Michael Van Canneyt <<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>> ha<br>
> scritto:<br>
><br>
>><br>
>><br>
>> On Wed, 3 Jun 2020, Francesco Sammarco wrote:<br>
>><br>
>>> sorry I don't understand, you say that just remove the lines where I<br>
>>> specify the timezone ?!<br>
>><br>
>> No, remove the<br>
>><br>
>> start_e.dateTime := LocalTimeToUniversal(start_e.dateTime);<br>
>><br>
>> I think it is not necessary if you set the timezone.<br>
>><br>
>> Michael.<br>
>><br>
>><br>
>>><br>
>>> Il mer 3 giu 2020, 14:51 Michael Van Canneyt <<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>> ha<br>
>>> scritto:<br>
>>><br>
>>>><br>
>>>><br>
>>>> On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote:<br>
>>>><br>
>>>>> Hi everyone, I have the following problem. I have a calendar (Italian)<br>
>> to<br>
>>>>> sync with Google Calendar. With the following code I can work quite<br>
>> well.<br>
>>>>> If today (2020-06-03) I set a new appointment it is saved on google<br>
>>>>> calendar on the right day and time, but if for example: always today<br>
>> if I<br>
>>>>> set an appointment for December 10, 2020 at 9 am, I find myself there<br>
>>>>> appointment set on the right day but at 8 am. (So an hour behind) I<br>
>> think<br>
>>>>> it's due to the change between sunlight and daylight. Can anyone<br>
>> explain<br>
>>>> to<br>
>>>>> me how to solve the problem?<br>
>>>>><br>
>>>>> Thank you<br>
>>>>> XinYiMan<br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>> var<br>
>>>>> start_e : TEventDateTime;<br>
>>>>> end_e : TEventDateTime;<br>
>>>>> Entry : TEvent;<br>
>>>>> begin<br>
>>>>> Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId,<br>
>>>>> my_id_app);<br>
>>>>><br>
>>>>> start_e := TEventDateTime.Create();<br>
>>>>> end_e := TEventDateTime.Create();<br>
>>>>><br>
>>>>> start_e.dateTime := data_appuntamento;<br>
>>>>> start_e.dateTime :=<br>
>>>>> LocalTimeToUniversal(start_e.dateTime);<br>
>>>>> start_e.timeZone := 'Europe/Rome';<br>
>>>><br>
>>>> If you set the timzeone explicitly, I don't think you must do a<br>
>>>> LocalTimeToUniversal,<br>
>>>> I think the timezone is then automatically taken into account. As I<br>
>>>> understand it you specify the timezone in dateTime or you set it in the<br>
>>>> timezone.<br>
>>>><br>
>>>> Michael.<br>
>>>><br>
>>><br>
>><br>
><br>
</blockquote></div>