Convert UTC to IST using C#

前端 未结 2 1284
青春惊慌失措
青春惊慌失措 2021-01-01 01:45

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



        
2条回答
  •  醉酒成梦
    2021-01-01 01:59

    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
    

提交回复
热议问题