Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not a valid time format?
(07-03-2020, 06:57 AM)Mikael Nilsson Wrote:
(07-02-2020, 03:31 PM)SorenJensen Wrote: Also you can use .value in the assign:

UserSession.FDQryUsersMod.FieldByName('UserID').value            := AnsiUppercase(inpUID.Text);
UserSession.FDQryUsersMod.FieldByName('PartID').value              := UserSession.UsersSelectedPartId;
UserSession.FDQryUsersMod.FieldByName('Uppldat').value            := now;

.value is a genetic type which will add the value as it is assigned, as long as the assigned and the assignee types are the same.

Thanks for the tip but my way of coding is working in Delphi 10.3.2 but not in Delphi 10.3.3
Also  text string is showing dates like this 05/01/2020 instead of 2020-05-01

We have identified the problem now. We are running the webpool with a specific Identity (User). That user id
was not  assign with Swedish Settings.
The same situation with batchjobs started with the scheduler. It is specific user for Scheduler to.
Only problem is that FormatDateTime('c',now)  still is problem.
When rewrite it to FormatDateTime('yyyy-mm-dd hh:nnConfuseds',now)  it worked.
The correct way of doing it is:

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:

procedure TIWServerController.IWServerControllerBaseConfig(Sender: TObject);
  SysUtils.FormatSettings.ShortDateFormat := 'dd/mm/yyyy';

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

Forum Jump:

Users browsing this thread: 1 Guest(s)