I am doing some date calculations through code and am trying to set a couple nodes on my infopath form to these returned values. I would like to set them as datetime but I am not sure how to do that. I am currently setting them as strings. However, this is a problem because I get data validation errors since the nodes use the datetime data type. Is there a way to set them as datetime rather than converting them to strings? This is probably easier to understand by looking at my code:
string scd2 = string.Empty;
string scd3 = string.Empty;
string scd = MainDataSource.CreateNavigator().SelectSingleNode("/dfs:myFields/my:queryResults2/my:resultsRow2/my:scd", NamespaceManager).Value;DateTime dt = Convert.ToDateTime(scd).AddMonths(18);
scd2 = dt.ToShortDateString();
e.Source.SelectSingleNode(
"/dfs:myFields/my:scd2", NamespaceManager).SetValue(scd2);DateTime dt2 = Convert.ToDateTime(dt).AddMonths(18);
scd3 = dt2.ToShortDateString();
e.Source.SelectSingleNode(
"/dfs:myFields/my:scd3", NamespaceManager).SetValue(scd3);