August 10, 2011 at 9:38 am
Hi
I currently have a report with start and end date parameters. When I choose a date from the calendar drop down it then appears in the parameter in British format e.g. 08/02/2011, which is what I want. However, the generated report shows data for 02/08/2011 (American format - bad!). I then tried typing the date as 2011-02-08 and it still came back with the wrong data. Only when I enter the date as 02/08/2011 do I receive the correct information.
I've never experienced this problem before. I've always thought that somewhere along the line that the dates are converted back to American in order for the sproc to deal with them correctly. Is this not the case or is there something I'm doing wrong?
I know the report can be used by entering dates in American format but we have many users, including Senior Management, and explaining this to them could be difficult (especially since it is so easy to choose from a calendar drop down!!).
Any ideas on how to fix this or for a way round it would be greatly appreciated.
Thanks in advance
Ross
August 10, 2011 at 10:08 am
Can you convert the date into the correct format in the stored procedure to return the correct data?:
CONVERT(nvarchar(10), GETDATE(), 101) -for US
CONVERT(nvarchar(10), GETDATE(), 103) -for British
Additional info on Cast and Convert: http://msdn.microsoft.com/en-us/library/ms187928.aspx
August 11, 2011 at 2:36 am
Sorry, was a bit brain dead yesterday! That worked a treat thanks.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply