Ticket Q485228
Visible to All Users

How to set the first day of the week?

created 12 years ago

What determines the first day of the week when I use foLastWeek, foThisWeek and foNextWeek to set filters?

Apparently it is uses Sunday as the first day of the week. Is there any way to change that so that it uses Monday? My application deals with a work week where most users consider Monday as the first work day. I would assume that many deal with the same issue.

Related to this question, is there a function that returns what the starting and ending dates is when I programatically set the filter use operators like foLast14Days, foLastTwoWeeks etc…?

By the way I think you have a small error in the documentation. Please see the attachment for that.

Thanks in advance.

Answers approved by DevExpress Support

created 12 years ago (modified 12 years ago)

Hello,
The following code should help you set Monday as the first week day:

Delphi
uses cxFormats, cxDateUtils; procedure TForm1.FormCreate(Sender: TObject); begin cxFormatController.StartOfWeek := dMonday; end;

As for your note about the documentation, you are right - it should say foLast7Days. I have created a separate ticket to fix the "TcxFilterOperatorKind type" topic (Documentation - The TcxFilterOperatorKind type declaration contains the fcoLast7Days value rather than foLast7Days).

    Comments (2)

      Is this an application wide setting and if so, can it be set once on application startup? Or does it need to be with the creation of each form?
      Can I have one form where start of week is Monday and another where it is Sunday?

      DevExpress Support Team 12 years ago

        Hi Luke,
        This property affects the entire application, because all forms refer to the same instance of cxFormatController. It is not possible to define different days for different forms.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.