Topic: How to format date with DayOfWeek ?

Hello Dimitry
How to format date with DayOfWeek in fast report ? I try [DayOfWeek(report."sintua.tgl_sk")] but can not work..
I want get day of week ... Sunday, Monday etc..
Thanks you

Post's attachments

Attachment icon dateformat.PNG 114.63 kb, 171 downloads since 2019-07-05 

Re: How to format date with DayOfWeek ?

Hello.


Script for the report

procedure MemoDayOfWeekOnAfterData(Sender: TfrxComponent);
var
       s: string;
       d: integer;                                   
begin
       s := MemoDayOfWeek.Text;
       s := ReplaceStr(s, #13#10, '');                                                                     
       if ValidDate(s) then 
       begin                 
               d := DayOfWeek(StrToDate(s));
               case d of
                       1: s := 'Sunday';                         
                       2: s := 'Monday';
                       3: s := 'Tuesday';
                       4: s := 'Wednesday';
                       5: s := 'Thursday';
                       6: s := 'Friday';
                       7: s := 'Saturday';
                       else s := '';                                                     
               end;                          
                 
       end;
       MemoDayOfWeek.Text := s;
end;

Project with the example:

Post's attachments

Attachment icon Report DayOfWeek.zip 111.16 kb, 310 downloads since 2019-07-08 

Dmitry.

Re: How to format date with DayOfWeek ?

Thanks Dimitry for your example, but i don't know how this project work...  can you tell me step by step this script ?

Re: How to format date with DayOfWeek ?

Please attach your project.

Dmitry.

Re: How to format date with DayOfWeek ?

script used in fastReport script... open fastreport in report designer and view code...

Re: How to format date with DayOfWeek ?

Hi Agusecc, Dmitry,
An alternative might be to use a calculated field to show the day of the week.  Then the calculated field can be used in your report just like any other data fields.
Please see the attached as a simple example.
Regards,
Derek.

Post's attachments

Attachment icon all.zip 340.01 kb, 322 downloads since 2019-07-13 

Re: How to format date with DayOfWeek ?

Thanks you verry much Dimitry and Derek... I am understand now...