Changing date format in parameters

  • Hi Guys,

    I'd like to use the date time parameters for a report, but they keep defaulting to mdy format.

    How do I set the them to dmy parameters?

    Thanks

    Donald

  • Like many things, it depends. Can you be a bit more specific? Where do you want the datatime parameters to be dmy instead of mdy? Do you want it that way when they are entered into the report, or when they are passed to the database in your dataset or when they are presented to the user as the report renders? There are a variety of places where the regional settings can be set which will affect the way the dates are presented to the users. The regional settings can be set on the individual report, as well as the report server and the backend database as well. Also regional settings from the local machine/browser also come into play. Depending on how they are set, things may not work the way you expect them so you need to test well.

    Here's a link to an MSDN article that describes hwo the regional settings affect a variety of things...

    http://msdn.microsoft.com/en-us/library/ms156493.aspx

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Luke L (6/24/2010)


    Like many things, it depends. Can you be a bit more specific? Where do you want the datatime parameters to be dmy instead of mdy? Do you want it that way when they are entered into the report, or when they are passed to the database in your dataset or when they are presented to the user as the report renders? There are a variety of places where the regional settings can be set which will affect the way the dates are presented to the users. The regional settings can be set on the individual report, as well as the report server and the backend database as well. Also regional settings from the local machine/browser also come into play. Depending on how they are set, things may not work the way you expect them so you need to test well.

    Here's a link to an MSDN article that describes hwo the regional settings affect a variety of things...

    http://msdn.microsoft.com/en-us/library/ms156493.aspx

    -Luke.

    Thanks for your reply Luke.

    Ideally the entire report should be dmy

    The servers regional settings are set to the UK format.

    The reports language field is set to English (United Kingdom).

    Is there anywhere else that needs to be configured?

    This issue occurs both in the Report Editor and once the report has been deployed and viewed in IE.

    I have two report parameters FromDate and ToDate which both have a data type of DateTime.

    On going to the Preview tab, I am able to specify the date using a date picker for both those fields.

    Say i used the date picker to select 25th June 2010, it writes the date in the proper format (ie 25/06/2010), however when I click the view report button I get the message

    "An error occurred during local report processing.

    The value provided for the report parameter 'FROMDATE' is not valid for its type."

    Is there any other info I should provide?

    Any suggestions on how I can sort this out?

    Thanks for your help.

  • Did the query get executed against the datasource? Can you see it in Profiler? How was the parameter passed? Also check the language and DMY settings of the database and/or server? You may need to account for them as well.

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Hi

    By default date picker is picking the date in M/d/YYYY format . Let it be...

    n if you want to show n use the DMY format in the query or in the report data table ..

    Use this :

    =FORMAT(Parameters!FDATE.Value,"dd-MM-yyyy")

  • To fix the date format on the report server (in 2005):

    Edit C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\Pages\ReportViewer.aspx and add Culture="en-XX" where XX is your country code.

    Example:

    <%@ Register TagPrefix="RS" Namespace="Microsoft.ReportingServices.WebServer" Assembly="ReportingServicesWebServer" %>

    <%@ Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage" Culture="en-AU" %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>

    <head id="headID" runat="server">

    <title>Report Viewer</title>

    </head>

    <body style="margin: 0px; overflow: auto">

    <form runat="server" ID="ReportViewerForm">

    <RS:ReportViewerHost ID="ReportViewerControl" runat="server" />

    </form>

    </body>

    </html>

    Unfortunately you are stuck with mm/dd/yy in Development Studio irrespective of you regional settings. Even entering "1 jun 2010" still becomes "6 jan 2010" in the report.

  • Hi,

    Use this expression..

    =Format(PARAMETERS!date.label,"DD-MM-YYYY")

    Regards,
    Gayathri 🙂

  • I put Culture="en-NZ" into C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\Pages\ReportViewer.aspx and it solved everything. Also ensure that your regional settings are set to correct region for dmy dates. Even in development mode I have dmy dates.

    This is a dump of my ReportViewer.aspx file

    <%@ Register TagPrefix="RS" Namespace="Microsoft.ReportingServices.WebServer" Assembly="ReportingServicesWebServer" %>

    <%@ Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage" Culture="en-NZ"%>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>

    <head id="headID" runat="server">

    <title>Report Viewer</title>

    </head>

    <body style="margin: 0px; overflow: auto">

    <form runat="server" ID="ReportViewerForm">

    <RS:ReportViewerHost ID="ReportViewerControl" runat="server" />

    </form>

    </body>

    </html>

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply