Click here to Skip to main content
16,016,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm thinking of building an application that can send you info over email about your day. The server will check the time that email should be sent and then send it. This method works great if there was only one time zone however different countries have different time zones. I'm currently using (UTC) Dublin, Edinburgh, Lisbon, London. My question is, is there a way to convert TimeZones in vb.net?

I tried something like this:

VB
Dim ZoneId As String = "Central America"
Dim localtime As DateTime = DateTime.Now
Dim timeZoneInfo As TimeZoneInfo = System.TimeZoneInfo.FindSystemTimeZoneById(ZoneId)
Dim dataTimeByZoneId As DateTime = System.TimeZoneInfo.ConvertTime(localtime, System.TimeZoneInfo.Local, timeZoneInfo)
Return dataTimeByZoneId


But nothing seems to be working.

Thanks in advance!
Posted

1 solution

I think You have Country table into your application. You can take one more column name timezone . You can store the Value of timezone Related to country, and during sending mail you can use convert_tz() function of MYSQL to convert your application timezone into Selected Country time Zone, and if it is satisfied then You can send the mail.

For Infomation About convert_tz(), See the Below Link:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_convert-tz[^]

Hope this will Help You.
 
Share this answer
 
Comments
Kieran Crown 1-Jul-13 15:12pm    
Thanks, I have had a look, what table would I need as I currently don't have any. And are there any examples of visual basic sql queries / code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900