07-04-2020, 02:38 AM
The correct way of doing it is:
As Soren mentioned
This is not related to IntraWeb directly. For some reason, your ShortDate format variable is being set to a different format (yyyy-mm-dd instead of dd/mm/yyyy) as you expect.
One thing that you must do if you convert from string to date frequently using FormatDateTime() (or DateTimeToStr()/StrToDate() etc.) is setting the desired format variables when the application starts:
In your OnConfig event, in ServerController, set it as desired:
nevertheless, I still recommend you to set the field value using AsDateTime which performs better, doesn't require multiple conversions from/to string and doesn't depend on current format settings
Code:
UserSession.FDQryUsersMod.FieldByName('Anddat').AsDateTime := Now;
As Soren mentioned
This is not related to IntraWeb directly. For some reason, your ShortDate format variable is being set to a different format (yyyy-mm-dd instead of dd/mm/yyyy) as you expect.
One thing that you must do if you convert from string to date frequently using FormatDateTime() (or DateTimeToStr()/StrToDate() etc.) is setting the desired format variables when the application starts:
In your OnConfig event, in ServerController, set it as desired:
Code:
procedure TIWServerController.IWServerControllerBaseConfig(Sender: TObject);
begin
SysUtils.FormatSettings.ShortDateFormat := 'dd/mm/yyyy';
end;
nevertheless, I still recommend you to set the field value using AsDateTime which performs better, doesn't require multiple conversions from/to string and doesn't depend on current format settings