Jump to content

Add Day-name in UniDBGrid


erich.wanker

Recommended Posts

Hy ..

i want to add the day-name to a uniDBGrid-cell ... just show the value in the Grid .. NO CHANGE in the DB (field = date)

 

STARTDATUM is the start date of the schedule 

procedure TERMINCalcFields(DataSet: TDataSet);
var wochentag: string;
    datum: TDateTime;
    LongDayNames : array[1..7] of string;
begin
  LongDayNames[1] := 'Sonntag';
  LongDayNames[2] := 'Montag';
  LongDayNames[3] := 'Dienstag';
  LongDayNames[4] := 'Mittwoch';
  LongDayNames[5] := 'Donnerstag';
  LongDayNames[6] := 'Freitag';
  LongDayNames[7] := 'Samstag';


  datum :=Termin.FieldByName('STARTDATUM').AsDateTime;
  wochentag := LongDayNames[DayOfWeek(datum)];
  Termin.FieldByName('STARTDATUM').asstring := wochentag+', '+datetostr(datum);


end;

..but didn´t work ...

 

How can i fix this ....

 

ThanX

Link to comment
Share on other sites

Use field->GetText event:

procedure TUniMainModule.QryDocinvestigationDoc_TimeGetText(Sender: TField;
  var Text: string; DisplayText: Boolean);
begin
 Text:=FormatDateTime('dd/MM/yyyy HH:mm',QryDocinvestigation.FieldByName('Doc_Time').AsDateTime);
end;
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...