erva 2 Posted May 11, 2020 Trying to format date to show dd.mm.yyyy but don't get how it's complished. Have tried it with columns "customFormat" property but with no success. Share this post Link to post
Lars Fosdal 1792 Posted May 11, 2020 Are you using Format? You should be using FormatDateTime. FormatDateTime('dd.mm.yyyy', Now); should yield '11.05.2020' Share this post Link to post
erva 2 Posted May 11, 2020 I'am using FormatDateTime('dd.mm.yyyy', %s) and get error "Invalid class typecast". Share this post Link to post
erva 2 Posted May 11, 2020 Tried FormatDateTime('dd.mm.yyyy', Now); but get this exception: Share this post Link to post
Lars Fosdal 1792 Posted May 11, 2020 Your problem is with LiveBindings. http://docwiki.embarcadero.com/Libraries/Rio/en/System.Bindings.EvalProtocol.EEvaluatorError I don't use LiveBindings, so I don't know how to solve your problem. Share this post Link to post
Serge_G 87 Posted May 11, 2020 1 hour ago, erva said: I'am using FormatDateTime('dd.mm.yyyy', %s) and get error "Invalid class typecast". %s is yet a string so it's somewhere normal Try FormatDateTime('dd.mm.yyyy',value) or declare your fields, set your date field displayformat property to 'dd.mm.yyyy' and use displaytext in customformat 1 Share this post Link to post
mausmb 13 Posted May 11, 2020 3 hours ago, erva said: Trying to format date to show dd.mm.yyyy but don't get how it's complished. Have tried it with columns "customFormat" property but with no success. Hi, TFormatSettings.Create; FormatSettings.ShortDateFormat := 'dd.MM.yyyy'; // FormatSettings.LongDateFormat := 'dd.MM.yyyy'; // FormatSettings.DateSeparator := '.'; FormatSettings.ShortTimeFormat := 'hh:mm:ss'; // FormatSettings.LongTimeFormat := 'hh:mm:ss'; // regards, M Share this post Link to post
erva 2 Posted May 11, 2020 (edited) That 'displaytext' property i was missing from grid side, thanks a lot:) Edited May 11, 2020 by erva Share this post Link to post
erva 2 Posted May 15, 2020 Mysterious things happening.... I got date formatting working ok. But then made changes to DB structure and after that grids first and last dates show like they should, others not Share this post Link to post