Problem with CDate function and "dd-mm-yyyy" regional settings


  • Hi,


    I'am trying to write a custom report for TFS using a visual studio 2005 BI project. As a starting point I used


    It all works fine except for the date filter. The CDate function always assumes that the date format is mm-dd-yyyy while my regional settings are dd-mm-yyyy. This results in an error when the user selects a date range in the report.


    Is there any workarround?


    Worth mentioning: I started out in VS2008 and SQL Server 2008. No problem there. But the production environment is Sql Server 2005 and it is not possible to deploy 2008 reports on a 2005 SQL Server. So I started over in 2005.



    Tuesday, November 18, 2008 1:11 PM


All replies

  • ".. The CDate function always assumes that the date format is mm-dd-yyyy .." - that doesn't seem to be the case, based on the link below. So maybe the locale isn't set consistently somewhere (like on the Report Server)?
    Visual Basic Language Reference


    CDate recognizes date formats according to the locale setting of your system. You must provide the day, month, and year in the correct order for your locale, or the date may not be interpreted correctly. A long date format is not recognized if it contains a day-of-the-week string, such as "Wednesday".

    Tuesday, November 18, 2008 7:29 PM
  • Found it. The problem is not the CDate function but the Calendar control on the report. More info here:

    Wednesday, November 19, 2008 7:25 AM