Sunday, March 11, 2012

DateTime Format / Language Problem

Hi,
I'm having a problem with the datetime format in RS. I live in Canada but
want to use the "en-US" language setting because most of our clients using
the app are in the States. What I'm doing is formatting a start and end date
parameter from a .NET calendar control with "MM/DD/YYYY" before sending it
to the report for generation. If the user has "en-US" selected as their
language in IE, the report runs great. If they have "en-CA" selected as
their language, the month and day displays backwards, so Aug 25, 2004 shows
up as 24/8/2004 which crashes the report (obviously because there isn't a
24th month).
So I specified "en-US" in the report definition language property, I
included rs:ParameterLanguage=en-US in my URL call and I pasted the
following code into my global.asax file under BeginRequest to convert
threads to use "en-US":
Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
Nothing seems to be working...Am I missing something? Thanks,I just wanted to add to my post that the main toolbar is visible and
parameter toolbar is NOT visible.
Now if i hide the main toolbar, so both toolbars are hidden, the dates come
out properly and the report works regardless if the browser is set to
"en-US" or "en-CA".
Why does the visibility of the toolbars have anything to do with the way the
datetime format is displayed? We need to hide the parameter toolbar and show
the main toolbar for this particular application, but then the date gets
mixed up and the report won't work. Is this a bug?
"RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
news:eXhvC$siEHA.2760@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I'm having a problem with the datetime format in RS. I live in Canada but
> want to use the "en-US" language setting because most of our clients using
> the app are in the States. What I'm doing is formatting a start and end
date
> parameter from a .NET calendar control with "MM/DD/YYYY" before sending it
> to the report for generation. If the user has "en-US" selected as their
> language in IE, the report runs great. If they have "en-CA" selected as
> their language, the month and day displays backwards, so Aug 25, 2004
shows
> up as 24/8/2004 which crashes the report (obviously because there isn't a
> 24th month).
> So I specified "en-US" in the report definition language property, I
> included rs:ParameterLanguage=en-US in my URL call and I pasted the
> following code into my global.asax file under BeginRequest to convert
> threads to use "en-US":
> Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> Nothing seems to be working...Am I missing something? Thanks,
>|||Instead of using the .NET calendar control, have you considered modifying
the SQL statement and using either 102 is ANSI (yy/mm/dd), but 103 is
British/French (dd/mm/yy).
WHERE (CONVERT(varchar(10), time, 102) = CONVERT(varchar(10),
DATEADD(dd, - 2, { fn NOW() }), 102))
CONVERT(varchar(10), CONVERT(varchar(4), DATEPART(yy, time)) + '/' +
CONVERT(varchar(2), DATEPART(mm, time)) + '/' + CONVERT(varchar(2),
DATEPART(dd, time)), 102)
Rory
"RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
news:eB8BNKtiEHA.2544@.TK2MSFTNGP10.phx.gbl...
> I just wanted to add to my post that the main toolbar is visible and
> parameter toolbar is NOT visible.
> Now if i hide the main toolbar, so both toolbars are hidden, the dates
come
> out properly and the report works regardless if the browser is set to
> "en-US" or "en-CA".
> Why does the visibility of the toolbars have anything to do with the way
the
> datetime format is displayed? We need to hide the parameter toolbar and
show
> the main toolbar for this particular application, but then the date gets
> mixed up and the report won't work. Is this a bug?
>
> "RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
> news:eXhvC$siEHA.2760@.TK2MSFTNGP15.phx.gbl...
> > Hi,
> >
> > I'm having a problem with the datetime format in RS. I live in Canada
but
> > want to use the "en-US" language setting because most of our clients
using
> > the app are in the States. What I'm doing is formatting a start and end
> date
> > parameter from a .NET calendar control with "MM/DD/YYYY" before sending
it
> > to the report for generation. If the user has "en-US" selected as their
> > language in IE, the report runs great. If they have "en-CA" selected as
> > their language, the month and day displays backwards, so Aug 25, 2004
> shows
> > up as 24/8/2004 which crashes the report (obviously because there isn't
a
> > 24th month).
> >
> > So I specified "en-US" in the report definition language property, I
> > included rs:ParameterLanguage=en-US in my URL call and I pasted the
> > following code into my global.asax file under BeginRequest to convert
> > threads to use "en-US":
> >
> > Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> >
> > Nothing seems to be working...Am I missing something? Thanks,
> >
> >
>|||Rory, thanks for your suggestion. Our client requested a graphical calendar
to pick dates so unfortunately I have to use the calendar control. The
problem for some reason is tied into the visibility of the toolbars, these
are the only combinations of visibility where the date gets formatted
properly (why the visibility of the toolbar is affecting date formatting is
beyond me):
Parameter = false, toolbar=false
Parameter = true, toolbar=true
Parameter = collapse , toolbar=true
However I need:
Parameter = false, toolbar=true
but then the date gets switched to dd/mm/yyyy and the report crashes...
"Rory McCaw" <mccawr@.rogers.com> wrote in message
news:ejYdThtiEHA.4020@.TK2MSFTNGP10.phx.gbl...
> Instead of using the .NET calendar control, have you considered modifying
> the SQL statement and using either 102 is ANSI (yy/mm/dd), but 103 is
> British/French (dd/mm/yy).
> WHERE (CONVERT(varchar(10), time, 102) = CONVERT(varchar(10),
> DATEADD(dd, - 2, { fn NOW() }), 102))
> CONVERT(varchar(10), CONVERT(varchar(4), DATEPART(yy, time)) + '/' +
> CONVERT(varchar(2), DATEPART(mm, time)) + '/' + CONVERT(varchar(2),
> DATEPART(dd, time)), 102)
> Rory
> "RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
> news:eB8BNKtiEHA.2544@.TK2MSFTNGP10.phx.gbl...
> > I just wanted to add to my post that the main toolbar is visible and
> > parameter toolbar is NOT visible.
> >
> > Now if i hide the main toolbar, so both toolbars are hidden, the dates
> come
> > out properly and the report works regardless if the browser is set to
> > "en-US" or "en-CA".
> >
> > Why does the visibility of the toolbars have anything to do with the way
> the
> > datetime format is displayed? We need to hide the parameter toolbar and
> show
> > the main toolbar for this particular application, but then the date gets
> > mixed up and the report won't work. Is this a bug?
> >
> >
> > "RS Developer" <idroppeddabomb@.hotmail.com> wrote in message
> > news:eXhvC$siEHA.2760@.TK2MSFTNGP15.phx.gbl...
> > > Hi,
> > >
> > > I'm having a problem with the datetime format in RS. I live in Canada
> but
> > > want to use the "en-US" language setting because most of our clients
> using
> > > the app are in the States. What I'm doing is formatting a start and
end
> > date
> > > parameter from a .NET calendar control with "MM/DD/YYYY" before
sending
> it
> > > to the report for generation. If the user has "en-US" selected as
their
> > > language in IE, the report runs great. If they have "en-CA" selected
as
> > > their language, the month and day displays backwards, so Aug 25, 2004
> > shows
> > > up as 24/8/2004 which crashes the report (obviously because there
isn't
> a
> > > 24th month).
> > >
> > > So I specified "en-US" in the report definition language property, I
> > > included rs:ParameterLanguage=en-US in my URL call and I pasted the
> > > following code into my global.asax file under BeginRequest to convert
> > > threads to use "en-US":
> > >
> > > Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> > >
> > > Nothing seems to be working...Am I missing something? Thanks,
> > >
> > >
> >
> >
>

No comments:

Post a Comment