Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-09-02
1
Medium Priority
?
620 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Whether you’re looking to gather data for research or gather feedback on an idea, being able to build and distribute your own online survey is not only cost-effective, but allows you to reach a larger audience and receive results in real-time. Googl…
This Micro Tutorial will demonstrate without sampling how to find out top organic landing pages. The hack gets around the standard way to find the pages in Google Analytics results in sampling for larger sites.
This Micro Tutorial demonstrates the importance of annotations in Google Analytics and how they should be used to document changes made to a site, Google updates (Ex: Panda & Penguin), marketing campaigns, and any other events that might have contri…
Suggested Courses

705 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