date format settings w/o creating a custom format

Stimulsoft Reports.WEB discussion
nilesh8600
Posts: 19
Joined: Tue Feb 16, 2016 10:16 am

date format settings w/o creating a custom format

Post by nilesh8600 »

Is there a way for Stimulsoft to inherent the date format settings w/o creating a custom format for each date column that will check the settings?
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: date format settings w/o creating a custom format

Post by HighAley »

Hello.

Sorry, maybe we don;t understand you right.
Please, describe your issue more detailed with samples.

Thank you.
nilesh8600
Posts: 19
Joined: Tue Feb 16, 2016 10:16 am

Re: date format settings w/o creating a custom format

Post by nilesh8600 »

We want to set the date format dynamically in the stimulsoft reports based on the localization i.e., American (MM-dd-yyyy) vs Indian (dd-MM-yyyy), But in our .mrt files we have hardcoded the date format. Is there a way we can set the date formats dynamically from the database?
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: date format settings w/o creating a custom format

Post by HighAley »

Hello.

Did you try to change the Culture property of the report.
The date format should be changes when you change the Culture property.

Thank you.
nilesh8600
Posts: 19
Joined: Tue Feb 16, 2016 10:16 am

Re: date format settings w/o creating a custom format

Post by nilesh8600 »

And how could we set it, If we want to set it dynamically from the database on run-time?

example: We will be having a field (data format) which user will populate, like he could enter any format he wants and it should be reflected in the stimulsoft reports.

User could enter, dd-MM-yyyy or MM-dd-yy or MM/dd/yyyy etc., and when we execute or application that entered date format we will pass to the stimulsoft and the date field on reports should reflect those changes.

Please suggest a possible way, with example if any.

Thanks,
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: date format settings w/o creating a custom format

Post by Ivan »

Hello,

If we understand you correctly then you should use the DateTime.ToString() method.
Please check the report sample in the attachment.

Thank you.
Attachments
DynamicDateFormat.mrt
(6.54 KiB) Downloaded 501 times
nilesh8600
Posts: 19
Joined: Tue Feb 16, 2016 10:16 am

Re: date format settings w/o creating a custom format

Post by nilesh8600 »

Thank you Ivan and HighAley. Will try both of the options and in case of any concerns will get back to you :)
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Re: date format settings w/o creating a custom format

Post by Andrew »

Hello,

Great! Let us know about the result.

Thank you.
Prajyot
Posts: 4
Joined: Sat Mar 14, 2020 6:59 pm

Re: date format settings w/o creating a custom format

Post by Prajyot »

Hi Andrew,

Is it possible to format date time, numbers etc dynamically at runtime in text editor based on culture variable value e.g. "fr-FR"

Regards,
Prajyot
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: date format settings w/o creating a custom format

Post by HighAley »

Hello, Prajyot.

The dates and numbers will be formatted based on the Culture of the report.
Also, you could use ToString() method and specify Culture or other settings there.

Thank you.
Post Reply