Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Indian Standard Time(IST) in c#?

Tags:

c#

datetime

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... Any suggestion....

like image 474
ACP Avatar asked Jul 16 '10 05:07

ACP


People also ask

How do we calculate Indian Standard Time?

Indian Standard Time is calculated from the clock tower in Mirzapur nearly exactly on the reference longitude of IST at 82°30'E, within 4 angular minutes. In 1905, the meridian passing east of Allahabad was declared as a standard time zone for British India and was declared as IST in 1947 for the dominion of India.

What is the current IST time in India?

It is 14:24:57 right now.

How do you write IST time?

Currently observing IST – India Standard Time. Currently has same time zone offset as IST (UTC +5:30) but different time zone name. India Standard Time (IST) is 5:30 hours ahead of Coordinated Universal Time (UTC). This time zone is in use during standard time in: Asia.

What is Indian Standard Time Class 9?

-In India, the longitude of 82° E meridian is regarded as the standard time for the whole country and is known as the Indian Standard Time (IST). -Indian Standard Time which passes through Mirzapur, in Uttar Pradesh is calculated on the basis of 82°30'E longitude.


1 Answers

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.

like image 135
Matthew Flaschen Avatar answered Sep 20 '22 14:09

Matthew Flaschen