Ok I got a different approach than others:
Here is simplified code:
public delegate void MyHandler (object sender);
MyHandler _myEvent;
public event MyHandler MyEvent
{
add
{
_myEvent += value;
DoSomethingElse();
}
remove
{
_myEvent -= value; // <-- ReSharper warning here
}
}
Firstly, I assumed few things before hand.
gitude; var div = document.getElementById("location");Person who is listing an event has smartphone(if it is a browser, I dont have to make these assumptions) with:
GPS
HTML5 capability.
Javascript capability
How should I save the time stamps in the database?
Step 2. Give the (Long,Lat) as arguements to some of the (Lat,Long) to TimeZone api's like the Yahoo API (use Flag R to get the Latitude converted to Timezone) to get the users timezone.
Solution: Obviously UTC, I overlaid procedure below:
=> The users timezone is determined without user input ( I am using this because you cannot simply assume that user knows the timezone of place he lives in, I knew my timezone only after few months or something at the place :P, pretty dumb!)
The each Event table has Timezone
, Event
& so can also have CityName
Then create another database table with classification based on CityName
s. So here the user will have two columns
|---------------------------------------|
|_____NewYork________|______Sydney______|
| | |
|Event 1 | Event 2 |
|____________________|__________________|
Step 1. Use the Geolocation of the user using the Geolocation API
window.onload = getMyLocation; function getMyLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(displayLocation); } else { alert("Oops, no geolocation support"); } } function displayLocation(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; var div = document.getElementById("location"); div.innerHTML = "You are at Latitude: " + latitude + ", Longitude: " + longitude; }
For UI
Step 2. Give the (Long,Lat) as arguements to some of the (Lat,Long) to TimeZone api's like the Yahoo API (use Flag R to get the Latitude converted to Timezone) to get the users timezone.
=> use Google Calendar API or some of the Calendar API's
=> The users timezone is determined without user input ( I am using this because you cannot simply assume that user knows the timezone of place he lives in, I knew my timezone only after few months or something at the place :P, pretty dumb!)
The each Event table has Timezone
, Event
& so can also have CityName
Then create another database table with classification based on CityName
s. So here the user will have two columns
|---------------------------------------|
|_____NewYork________|______Sydney______|
| | |
|Event 1 | Event 2 |
|____________________|__________________|
For UI
=> use Google Calendar API or some of the Calendar API's
Related Readings:
Related Readings:
Determine timezone from latitude/longitude without using web services like Geonames.org
Determine timezone from latitude/longitude without using web services like Geonames.org
I know its just about showing some idea how to solve this problem. But see how accurate & light-weight it becomes on users when the Timezone is determined by using device APIs
Hope it helps!