I have tried to convert a Specific UTC time into IST time. But, I got the same date as the output.
// utcdate is 6/15/2014 12:00:00 AM
var istdate = TimeZoneInfo.ConvertTimeFromUtc(utcdate,
TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));
Output :6/15/2014 12:00:00 AM
Could you please guide me to resolve this issue?
Try This:
DateTime utcdate = DateTime.ParseExact("6/15/2014 12:00:00 AM", "M/dd/yyyy
h:mm:ss tt",CultureInfo.InvariantCulture);
var istdate = TimeZoneInfo.ConvertTimeFromUtc(utcdate,
TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));
I'm getting output :
6/15/2014 5:30:00 AM
You could also try:
DateTime utc = TimeZoneInfo.ConvertTimeToUtc(new DateTime(2014, 6, 16, 2, 0, 0));
DateTime temp = new DateTime(utc.Ticks, DateTimeKind.Utc);
DateTime ist = TimeZoneInfo.ConvertTimeFromUtc(temp, TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With