Hi friends,
I am using Asp.Net application. I need to convert world all country time zone to Indian time zone. Is possible in .net application? Please tell me.
Hope yours reply.
Printable View
Hi friends,
I am using Asp.Net application. I need to convert world all country time zone to Indian time zone. Is possible in .net application? Please tell me.
Hope yours reply.
If you are using .Net 3.5 you can use TimeZoneInfo class. It seems this functionality was not there previously. MSDN
Hi
Thanks for your reply. I am using Asp.Net 2.0 . Tell me please using web services, Is it possible?
Hope your's reply.
Thanks
From whatever I know, apparently not. But if you are publishing a web service why don't you use UTC time to relay and then the consumer can convert it into their local time zone. Even if your application is the only consumer you can still do so.
HI
Thanks for your reply. I am not asking like that. In currency converter, codeproject.com website give useful coding using web services. For the same i need for this one.
Without web service any possible ways are for this one. Give some details.
I am using java script code. But its very hard to differ time. Because this script given half an hour difference to my country times.
function calckTime(city,offset)
{
//alert("enter");
//alert(city);
//alert(offset);
// create Date object for current location
d = new Date();
alert(d);
var clockTime = getClockTime();
// alert(clockTime);
// convert to msec
// add local time zone offset
// get UTC time in msec
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
alert(utc);
// create new Date object for different city
// using supplied offset
nd = new Date(utc + (3600000*offset));
alert(nd);
//return "The local time in " + city + " is " + nd.toLocaleString();
var TimeName=document.getElementById('txtoffset');
alert(TimeName);
TimeName.value=nd;
// var TimeAnotherName=document.getElementById('txtoffsetanothor');
//
// TimeAnotherName.value=nd;
}
This is my script.
Hope your's reply.
Thanks
You just take the logic using TimeZoneInfo and instead of putting it in a method on your page, put it in a method in a web service. Your application then calls the web service, the web service simply uses TimeZoneInfo.