Page 1 of 1

DateTime variable format

Posted: Wed Sep 15, 2021 2:19 am
by eh13
I'm trying to set a User Request DateTime type variable for my report

Code: Select all

report.Dictionary.Variables["OrderCreatedDat"].Value = order.CreatedDate.ToString();
When I do this i get an argument exception with the message Variable value '14/09/2021 10:32:56 AM' is wrong DateTime value.

I've also tried formatting the date to an ISO8601 standard string, but that gets me an error when compiling the report because there's no implicit conversion between 'System.DateTime' and 'string'.

How do I set this value?

Re: DateTime variable format

Posted: Wed Sep 15, 2021 9:16 am
by Lech Kulikowski
Hello,

Please send us a sample that reproduces the issue for analysis.

Thank you.

Re: DateTime variable format

Posted: Thu Sep 16, 2021 2:20 am
by eh13
I'm not setting this value in the report .mrt file, the example I included in the post is exactly what I'm doing. Stimulsoft.Report.StiReport type for the report object, and "order.CreatedDate" is a DateTime field.

I'm using the Designer v2021.3.1

Re: DateTime variable format

Posted: Thu Sep 16, 2021 1:42 pm
by Lech Kulikowski
Hello,

Please try to use the following code:
report.Dictionary.Variables["OrderCreatedDat"].ValueObject = order.CreatedDate;

Thank you.

Re: DateTime variable format

Posted: Fri Sep 17, 2021 12:58 am
by eh13
When I do that I get:

error CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DateTime' and 'string'

Re: DateTime variable format

Posted: Fri Sep 17, 2021 12:30 pm
by Lech Kulikowski
Hello,

Please send us a sample project that reproduces the issue for analysis.

Thank you.

Re: DateTime variable format

Posted: Thu Mar 09, 2023 4:57 am
by eh13
When I passed the variable as type string insted, the field's Date Format still affected it as a string

Re: DateTime variable format

Posted: Thu Mar 09, 2023 10:00 pm
by Lech Kulikowski
Hello,

Please send us a sample that reproduces the issue for analysis.

Thank you.