Showing posts with label selected. Show all posts
Showing posts with label selected. Show all posts

Wednesday, March 21, 2012

DateTime Parameter need yyyy-mm-dd format

I have a parm defined as DateTime in RS2005 (so you see the calendar control
for the parm) .. when selected ... the format is mm/dd/yyyy and I need it to
display yyyy-mm-dd as it was when we had date defined as string rather than
DateTime. I went into regional settings on my pc and changed the date
setting in my regional options to display date as yyyy-MM-dd and it still
didnt seem to work. Can someone direct me? ThanksHi.
You have a language setting in the reports properties.
The default setting for language is "English (United States)". You can
change that either to what the user have choosen in IE by chosing "Default"
or what you want it to be. If you need yyyy-MM-dd you just change to your
country's setting.
You can override this setting for certain textboxes if you like. Textboxes
have their own language setting.
Kind regards
Maran
*********************
"MJT" wrote:
> I have a parm defined as DateTime in RS2005 (so you see the calendar control
> for the parm) .. when selected ... the format is mm/dd/yyyy and I need it to
> display yyyy-mm-dd as it was when we had date defined as string rather than
> DateTime. I went into regional settings on my pc and changed the date
> setting in my regional options to display date as yyyy-MM-dd and it still
> didnt seem to work. Can someone direct me? Thanks|||Thank you Maran,
I had changed my regional settings in control panel prior to posting my
message, but I didnt realize that they wouldnt take effect until I closed out
of VS and re-entered. Which brings another question to mind. If we want the
date displayed as yyyy-MM-dd format can that be accomplished solely by
setting to "English(United States)"? Because when I noticed the problem
initially, I had my windows settings for date format as MM-dd-yyyy and my
language was English(United States) and that seemed to be why I saw the date
format as MM-dd-yyyy when I changed my parameter to DateTime format. I am
wondering if the users have their date format in windows set other than
MM-dd-yyyy if just making the language English(United States) will matter at
all now. Since that was the way my settings were originally. Is there a way
to enforce a date time format? I realize that each textbox has a format
parameter, but this textbox that referenced the date parameter had other code
in it which was being translated into multiple languages in a code block - so
I cant use the format property on the textbox itself - I would have to put it
in the code block somehow. Thanks again for your reply.
"Maran" wrote:
> Hi.
> You have a language setting in the reports properties.
> The default setting for language is "English (United States)". You can
> change that either to what the user have choosen in IE by chosing "Default"
> or what you want it to be. If you need yyyy-MM-dd you just change to your
> country's setting.
> You can override this setting for certain textboxes if you like. Textboxes
> have their own language setting.
> Kind regards
> Maran
> *********************
> "MJT" wrote:
> > I have a parm defined as DateTime in RS2005 (so you see the calendar control
> > for the parm) .. when selected ... the format is mm/dd/yyyy and I need it to
> > display yyyy-mm-dd as it was when we had date defined as string rather than
> > DateTime. I went into regional settings on my pc and changed the date
> > setting in my regional options to display date as yyyy-MM-dd and it still
> > didnt seem to work. Can someone direct me? Thanks|||I handled this by adding the format to my custom code. Thanks.
"MJT" wrote:
> Thank you Maran,
> I had changed my regional settings in control panel prior to posting my
> message, but I didnt realize that they wouldnt take effect until I closed out
> of VS and re-entered. Which brings another question to mind. If we want the
> date displayed as yyyy-MM-dd format can that be accomplished solely by
> setting to "English(United States)"? Because when I noticed the problem
> initially, I had my windows settings for date format as MM-dd-yyyy and my
> language was English(United States) and that seemed to be why I saw the date
> format as MM-dd-yyyy when I changed my parameter to DateTime format. I am
> wondering if the users have their date format in windows set other than
> MM-dd-yyyy if just making the language English(United States) will matter at
> all now. Since that was the way my settings were originally. Is there a way
> to enforce a date time format? I realize that each textbox has a format
> parameter, but this textbox that referenced the date parameter had other code
> in it which was being translated into multiple languages in a code block - so
> I cant use the format property on the textbox itself - I would have to put it
> in the code block somehow. Thanks again for your reply.
> "Maran" wrote:
> > Hi.
> >
> > You have a language setting in the reports properties.
> >
> > The default setting for language is "English (United States)". You can
> > change that either to what the user have choosen in IE by chosing "Default"
> > or what you want it to be. If you need yyyy-MM-dd you just change to your
> > country's setting.
> >
> > You can override this setting for certain textboxes if you like. Textboxes
> > have their own language setting.
> >
> > Kind regards
> > Maran
> >
> > *********************
> >
> > "MJT" wrote:
> >
> > > I have a parm defined as DateTime in RS2005 (so you see the calendar control
> > > for the parm) .. when selected ... the format is mm/dd/yyyy and I need it to
> > > display yyyy-mm-dd as it was when we had date defined as string rather than
> > > DateTime. I went into regional settings on my pc and changed the date
> > > setting in my regional options to display date as yyyy-MM-dd and it still
> > > didnt seem to work. Can someone direct me? Thanks

Monday, March 19, 2012

datetime functions...

Hi all,

I have a problem with date functions...

In my program I use weeks, and with this variable I need to know which is the first day of the selected week...

For example... I put week 52 in my program... how I can obtain the first day of this week? -> (22/12/2003).

I have proved with this functions...

SET DATEFIRST 1 (to configure Monday as first day of week)

SELECT DATEADD(ww,DATEDIFF(ww,0,GETDATE()),0)

With this I have the day of the current week... but I can't put my week in this function... aarrgggg.

Please help me...

Thanks a lot.I played around with this for a little bit, and this should get you what you are looking for:


ET DATEFIRST 7 -- set this back to the default of 7 -- shouldn't need to mess with this for this calculation

DECLARE @.firstDayOfCurrentWeek DateTime
DECLARE @.firstDayOfSelectedWeek DateTime
DECLARE @.WeeksToSubtract Integer
DECLARE @.myWeek Integer

SET @.myWeek = 52

SET @.firstDayOfCurrentWeek = DATEADD(ww,DATEDIFF(ww,0,GETDATE()),0)
SET @.WeeksToSubtract = @.myWeek - DATEPART(ww,@.firstDayOfCurrentWeek)
SET @.firstDayOfSelectedWeek = DATEADD(ww,@.WeeksToSubtract,@.firstDayOfCurrentWeek)

SELECT @.firstDayOfSelectedWeek

Terri