DateTime.ParseExact 工作不正常
DateTime.ParseExact not working properly
出于某种原因,我的代码无法正常工作,它可能在 contacthours.Hours1From
和 contacthours.Hours1To
部分。
ExtendedContactDetailsType contactdetails = new ExtendedContactDetailsType();
contactdetails.ClassifiedAdContactByEmailEnabled = true;
ContactHoursDetailsType contacthours = new ContactHoursDetailsType();
contacthours.Hours1AnyTime = false;
contacthours.Hours1Days = DaysCodeType.Weekdays;
contacthours.Hours1From = DateTime.ParseExact("08:00", "hh:mm", null);
contacthours.Hours1To = DateTime.ParseExact("16:00", "hh:mm", null);
contacthours.TimeZoneID = "Eastern";
contactdetails.ContactHoursDetails = contacthours;
item.ExtendedSellerContactDetails = contactdetails;
第一个问题是您没有使用 24 小时格式字符串:
contacthours.Hours1From = DateTime.ParseExact("08:00", "HH:mm", null);
contacthours.Hours1To = DateTime.ParseExact("16:00", "HH:mm", null);
这是否只是 的问题尚不清楚。
出于某种原因,我的代码无法正常工作,它可能在 contacthours.Hours1From
和 contacthours.Hours1To
部分。
ExtendedContactDetailsType contactdetails = new ExtendedContactDetailsType();
contactdetails.ClassifiedAdContactByEmailEnabled = true;
ContactHoursDetailsType contacthours = new ContactHoursDetailsType();
contacthours.Hours1AnyTime = false;
contacthours.Hours1Days = DaysCodeType.Weekdays;
contacthours.Hours1From = DateTime.ParseExact("08:00", "hh:mm", null);
contacthours.Hours1To = DateTime.ParseExact("16:00", "hh:mm", null);
contacthours.TimeZoneID = "Eastern";
contactdetails.ContactHoursDetails = contacthours;
item.ExtendedSellerContactDetails = contactdetails;
第一个问题是您没有使用 24 小时格式字符串:
contacthours.Hours1From = DateTime.ParseExact("08:00", "HH:mm", null);
contacthours.Hours1To = DateTime.ParseExact("16:00", "HH:mm", null);
这是否只是 的问题尚不清楚。