Answer the question
In order to leave comments, you need to log in
How to create DateTime with TimeZoneInfo without changing the time?
Everything seems to be simple. I have "New Zealand Standard Time", well, I have the time of the event as 15:00... That is, at this time in this time zone, the event occurs. Then it needs to be converted at different times.
I want to convert like this "TimeZoneInfo.ConvertTime", but how easy it is to create a DateTime object and a specific time zone???
I tried this, but how to proceed further and simply add this New Zealand and its time zone without time conversion, I can’t understand in any way ...
DateTime UnspecifiedDateTime = DateTime.SpecifyKind(new DateTime(2020, 08, 22, 15, 00, 0), DateTimeKind.Unspecified);
Answer the question
In order to leave comments, you need to log in
If so
DateTime UnspecifiedDateTime = DateTime.SpecifyKind(new DateTime(2020, 08, 22, 15, 00, 0), DateTimeKind.Unspecified);
var nzstTz = TimeZoneInfo.FindSystemTimeZoneById("New Zealand Standard Time");
var mskTz = TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time");
var mskTime = TimeZoneInfo.ConvertTime(UnspecifiedDateTime, nzstTz, mskTz);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question