0

I have to get google calendar events with following filters in c# using google-calendar-event api.

  • "calendarId"
  • "timezone"
  • "timeMin"/"timMax" [Eg : 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z]

Timezone is computed dynamically. On the basis of timezone (eg : "Europe/Zurich"), I need to provide timezone offset for "timeMin"/"timMax". How to create datetime object with above mentioned format for "timeMin"/"timMax" request parameters?

Unable to create above "timeMin"/"timeMax" datetime object with timezone retrieved from google calendar. I found TimezonesInfo class in .net accepts timezones with different id as compared to those used in google calendar. So, may be we need to retrieve timezone offset info as well from google only.

James Z
  • 12,209
  • 10
  • 24
  • 44
  • 1
    `DateTime` values do not have a format or an offset. Are you actually asking how to parse that text into a `DateTime` value? – Enigmativity Apr 16 '23 at 06:47
  • Maybe [here](https://stackoverflow.com/questions/17974633/get-timezone-offset-of-server-in-c-sharp) you can find useful information – Enrico Massone Apr 16 '23 at 07:32
  • See [this answer](https://stackoverflow.com/a/17974704/4331637) – Enrico Massone Apr 16 '23 at 07:32
  • Are you looking for [TimeZoneInfo.FIndSystemTimeZoneById](https://learn.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid)? – Klaus Gütter Apr 16 '23 at 07:34
  • I would be providing a specific timezone for which timezone offset is to be calculated. This can't be resolved with TimeZoneInfo.Local. – test user Apr 16 '23 at 13:06
  • @testuser - How will you provide a "specific timezone"? What input for that and the time do you actually have? The input shown in your question seems to contradict the idea that you will provide a time zone. You need to be clearer about your inputs and what your expected output is. – Enigmativity Apr 16 '23 at 22:49

0 Answers0