Why are DateTime variables truncated to the date?
Posted: Thu Dec 11, 2008 9:35 am
When adding a DateTime variable like this:
then it is converted to a ShortDateString and back to DateTime, so that the time information get's lost. I've checked this in the source and it seem to be done be intend. But why? It doesn't seem to make any sense to me, to strip off the time from a DateTime variable.
And the workaround is kinda ugly:
...just curious,
Tobias
Code: Select all
stiReport.Dictionary.Variables.Add("Variables", "DateTime1", "Date / Time", DateTime.Now);
And the workaround is kinda ugly:
Code: Select all
stiReport.Dictionary.Variables.Add("Variables", "DateTime2", "Date / Time", typeof(DateTime), DateTime.Now.ToString("yyyy-MM-dd HH:mm tt"), false);
Tobias