Hello
I have this as a calculated field for displaying dates like 1/1/2007
=DATEADD("d", Fields!TimeIncInteger.Value , DATEADD("n", Parameters!GMTOffSet.Value,Parameters!BDateTime.Value))
This format increments the day vaues fine but how can I get it to increment month vaues too.
i.e presently it gives me day numbers perfect 1/2/2007 ..2nd january
but for 5th february it gives date as 1/5/2007. month value remains 1.
any help appreciated.
thanks
I haven't tried this, but it looks like you are adding the minutes instead of months. Change the 'n' to an 'm'.
=DATEADD("d", Fields!TimeIncInteger.Value , DATEADD("m", Parameters!GMTOffSet.Value,Parameters!BDateTime.Value))
Hope this helps.
Jarret
|||Thanks Jarret,
I do need to add the mkinute offset too..its the conversion from UTC to local time.
for the month I have done this now
=DATEADD("m",Parameters!MONTH.value,DATEADD("d", Fields!TimeIncInteger.Value , DATEADD("n", Parameters!GMTOffSet.Value,Parameters!BDateTime.Value)))
but this gives me an incremented month..
ie for Janury 5th..
it gives the date as 2/5/2007 i.e feb 5th
Thanks
|||Oh, I'm sorry. Can you send some example records for TimeIncInteger, GMTOffSet, BDateTime, and how you want them to display as well?
Jarret
|||All right,
The inc integer values go from 0-27 for february,
GMT offset is fixed at -360
and BDate Time is in the format Feb 1 2007 6:00AM
I think if I do DATEADD("m",Parameters!GMTOffSet.Value - 1, DATEADD("d", Fields!TimeIncInteger.Value , DATEADD("n", Parameters!GMTOffSet.Value, Parameters!BDateTime.Value)))
it would work but would it be best practice to put -1 there.
thanks
kiran
|||Your original formula subtracts 6 hours from your BDateTime value, then adds TimeIncInteger days to that.
For example, the BDateTime value is 2/15/07 6am and the TimeIncInteger value is 21. The first thing in your expression is to remove 6 hours, making it 2/15/07 12am. Then, you add 21 days to this, making it 3/8/07 12am.
Depending on your starting day and increment value, the month will change. Is this not what you wanted?
Jarret
|||Yes Jarret,
The day should change like that.
Waht I have in the report is dates by month where month is a parameter.
SO on selection of a month the day values should go from 1...end of month which happens by the time increment value.
The problem I was facing is since the parameter is a dropdown of month how to get the month value to change.
After adding =DATEADD("m",Parameters!MONTH.value-1,DATEADD("d"......................)
this works but I wanted to know of a better way to do so rather than using the -1.
Thanks for the help.
Kiran.
No comments:
Post a Comment