Solved

VB.Net GMT/UTC and server time (specifically Google Calendar)

Posted on 2011-09-02
1
599 Views
Last Modified: 2014-11-12
Hi

I am linking  a web application to my Google calendar. The user can add events to their calendar using application.

I have a problem with the difference between GMT/UTC/BST and server time. Things work locally fine until it is hosted on remote server.

When the user inputs a new calendar entry, and clicks "OK" to make a new event, Google calendar (or somewhere between VB submitting the event and Google creating it) adds 6 or 7 hours (depending on if in BST or GMT/UTC)

e.g. if user inputs 6am on website, the value stored in Google calendar is made 12 or 1pm

In web.config (and pages) I have set <globalization uiCulture="en" culture="en-GB" />

See code for what is submitted to Google service.

NOTE: I also send an email to myself after creating event, using same properties, and it shows the USER INPUTTED Date/time - which is correct;
also, the results retrieved from Google calendar are correct for older appointments (both locally and on server)  are correct. When I make a new entry locally this works)

So the only problem is when creating an event on the SERVER.

Thanks in advance for help
Dim postUri As New Uri(CALENDAR_URI)
Dim calendarService = New CalendarService("JSCalendar")
calendarService.setUserCredentials("myuser", "mypassword")
Dim ev As New Google.GData.Calendar.EventEntry
ev.Title.Text = eventTitle
ev.Content.Content = content

' Set a location for the event. 
Dim eventLocation As New Where()
eventLocation.ValueString = location
ev.Locations.Add(eventLocation)
Dim eventTime As New [When](start, endTime)
ev.Times.Add(eventTime)

'write to service
ev = calendarService.Insert(postUri, ev)

Open in new window

0
Comment
Question by:rwallacej
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 36479720
I do not know the Google API, but usually, an application that expect to get times from everywhere around the world records it a UTC. Google knowing what they are doing, this is probably how they work.

The way to deal with date/times then, is to send the Universal Time to the server, something like the following:
start .ToUniversalTime

Open in new window


start is then adjusted to universal time according to the time zone set in your computer.

When you want to read back a time value from the server, you do the reverse. You convert the UTC value to the time zone of the receiving station:
start = dateFromServer.ToLocalTime

Open in new window

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Many of you may be aware of the recent Google Docs scam emails that have been floating around coming from various people that you know. Here's a guide on identifying How To Identify the Scam Email You will see an email from someone you’ve had co…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial will demonstrate common damaging and frequent mistakes I see in most analytic audits. Most of them are campaign tagging mistakes, so this video will break it down into simple steps.
Suggested Courses

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question