When i display my system date using
DateTime.Now() function It gives me system date and time and works fine but when i try to run this page on my server it gives me the DateTime of Server which is outside India But i want to pick up the time of India whenever this page is executed on server. I know it is possible through Culture Info Class..
Put:
private static TimeZoneInfo INDIAN_ZONE = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
as a field.
Then, use:
DateTime indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
to get the time as needed.


0 comments:
Post a Comment
Note: only a member of this blog may post a comment.