我有一个特定格式的日期字符串,我正在解析它在EST的本地时间。字符串中的数据在EST中有效。但是,创建的datetime对象是UTC时间。我该如何解决?
string ibdatetimestring = "20170712 15:26:49";
int year = int.Parse(ibdatetimestring.Substring(0, 4));
int month = int.Parse(ibdatetimestring.Substring(4, 2));
int day = int.Parse(ibdatetimestring.Substring(6, 2));
int h = int.Parse(ibdatetimestring.Substring(10, 2));
int m = int.Parse(ibdatetimestring.Substring(13, 2));
int s = int.Parse(ibdatetimestring.Substring(16, 2));
DateTime bartime = new DateTime(year, month, day, h, m, s, DateTimeKind.Local);