1

i have implemented a windows service which is for user's birthday reminder. at midnight this service sends a mail to the respective person who has birthday on that particular day. This is for users in India...

Now my requirement is to make that service for all users in the world... so what should I enhance in that service...? Because Indian time is different than other countries timings... If i fire that service at mid night as per indian time..it is possible that in india midnight means different timings in other countries... Plz suggest me a solution.

flq
  • 22,247
  • 8
  • 55
  • 77
Amit Patil
  • 1,893
  • 4
  • 19
  • 23
  • 4
    Why do people need reminding that it's their birthday? That's rather unfortunate – RichK Jul 21 '10 at 08:46
  • I clicked on this question out of reflex, thinking: "What? Whose birthday did I forget now?" – moxn Jul 21 '10 at 09:15

5 Answers5

2

The best is to keep the time in UTC. In that case, you can convert the time back to the regional time as required.

Kangkan
  • 15,267
  • 10
  • 70
  • 113
  • Hi...thankx for ur ans can u plz tell me how to keep time in UTC and how to convert that time in regional time.. – Amit Patil Jul 21 '10 at 09:07
2

show to birthday reminder on label

    DateTime birthday = Convert.ToDateTime("1991/12/24");
    int years = DateTime.Now.Year - birthday.Year;
    birthday = birthday.AddYears(years);
    DateTime check = DateTime.Now.AddDays(7);
    if ((birthday > DateTime.Now) && (birthday < check))
    {
        lbbirthday.Text = ("This week is your birthday !!!");
    }

for more details you can read show Birthday reminder in asp.net c#

1

You will need to store the users timezone offset and add/subtract this to your local time to know what time to fire off the email...

But to be honest would the user really care if the email arrived a few hours late or early, essentially it is still roughly the same day..

Richard Friend
  • 15,800
  • 1
  • 42
  • 60
0

You can look for example here for the timezone conversion. But how do you know where the person is? Is it stored somewhere, if yes, you check it in what timezone is that location and send the e-mail according to it.

Biroka
  • 609
  • 10
  • 23
0

Mate, you are talking to programmer's. 99.9% of them are aware that there are different time-zones in the world. If you have information about the user's locations, you can use the information in this question to prove in which timezone a user lives and send the message an the timezone's midnight time: Web service - current time zone for a city?

Community
  • 1
  • 1
flq
  • 22,247
  • 8
  • 55
  • 77