Squall_FF8 1 Posted Friday at 08:57 AM Hey guys, I have old MS SQL 2008 and a Query (FireDAC), that returns some fields in Date format. In a Delphi application all work great, it seems FireDac takes care to visualize Date to FormatSettings. However when I open a FastReport document, it seems it convert Date to a the PC local settings (different from my changes in FormatSettings). And that is not good, because on different machines, results could look differently. I wonder, is there a way, to force Dates in FastReport to be in my desired format regardless of the PC local? A possible solution, could be if I force the Query to return the desired format, I just wonder how? Share this post Link to post
Lars Fosdal 1877 Posted Friday at 09:18 AM https://stackoverflow.com/questions/38394002/how-to-format-date-on-ms-sql-server-2008 Share this post Link to post
Squall_FF8 1 Posted Friday at 11:03 AM Good old Convert ... I'm wondering is there more convenient way - to set format per session, like in Oracle (you set some local settings only for "your" session). The reason is that I have tables with 20+ fields (at least 6 are in date format) and that will make huge Select statements. Share this post Link to post
Lars Fosdal 1877 Posted Friday at 11:21 AM Can't you create a view that do the convert for you, so that you don't have to fiddle with the conversions in that SQL? Share this post Link to post
weirdo12 27 Posted Friday at 12:39 PM (edited) Add a BeforePrint handler to the memo control. Make sure that you clear the DataField and DataSet properties of the memo control or BeforePrint won't have any effect.. procedure Memo13OnBeforePrint(Sender: TfrxComponent); begin TfrxMemoView(Sender).Text := FormatDateTime('yyyy-mm-dd', <Ticket."ticket_date">); end; No formatting: With the BeforePrint: Edited Friday at 12:41 PM by weirdo12 1 Share this post Link to post
Squall_FF8 1 Posted Friday at 03:56 PM (edited) @weirdo12 Great example and practical illustration!!! May we adapt it, if the text is in RichView (instead of Memo) and it is more complicated, like: xxxxx [Ticket."ticket_date"] xxxxxx Edited Friday at 03:58 PM by Squall_FF8 Share this post Link to post
weirdo12 27 Posted Friday at 04:11 PM 8 minutes ago, Squall_FF8 said: May we adapt it, if the text is in RichView (instead of Memo) and it is more complicated, like: xxxxx [Ticket."ticket_date"] xxxxxx If you double-click the RichView component is there a Format tab? If so, look in expressions and pick your date/time column and set the format string there. If the RichView contains multiple columns, each one will be listed in Expressions. Share this post Link to post