Why are DateTime variables truncated to the date?

Stimulsoft Reports.NET discussion
Post Reply
Tobias
Posts: 104
Joined: Mon Nov 24, 2008 8:44 am

Why are DateTime variables truncated to the date?

Post by Tobias »

When adding a DateTime variable like this:

Code: Select all

stiReport.Dictionary.Variables.Add("Variables", "DateTime1", "Date / Time", DateTime.Now);
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:

Code: Select all

stiReport.Dictionary.Variables.Add("Variables", "DateTime2", "Date / Time", typeof(DateTime), DateTime.Now.ToString("yyyy-MM-dd HH:mm tt"), false);
...just curious,

Tobias
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Why are DateTime variables truncated to the date?

Post by Vital »

Hello Tobias,

Problem fixed. Patch will be available in build from 15 Dec.

Thank you.
Post Reply