locked
DateTime parameter - Visual Studio switching Date and Month RRS feed

  • Question

  • User-1036366738 posted

    I have a report with a Date/Time parameter.

    When I choose a date in the preview window (ex: January 2nd), month and day are automatically switched (ex: February 1st). And it switch back if I click "View Report" again.

    I do not have this issue when deploying it.

    What is happening ? It looks like a huge bug.

    Monday, December 8, 2014 5:41 AM

Answers

  • User281315223 posted

    There are a variety of issues that could be causing this, but it may likely boil down to your local globalization / localisation settings. Basically, when your values are passed into your code-behind in a specific format (such as "MM/dd/yyyy"), ASP.NET might be expecting them to be in "dd/MM/yyyy" and so when it parses the DateTime value, it's going to be incorrect. You may have to apply some code to indicate exactly the format that you are expecting (in ASP.NET, this would mean using the DateTime.ParseExact() method).

    What happens when you use a Date like January 13th ("01/13/2014")?  Does it blow up?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 8, 2014 9:42 AM