How to conver Date to yyyyMMdd format in SSRS
-
In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???
select ......
whereand F2TRDT >= " & Year(Parameters!DateFrom.Value)*10000+Month(Parameters!DateFrom.Value)*100+day(Parameters!DateFrom.Value) & "
and F2TRDT <= " & Year(Parameters!DateTo.Value)*10000+Month(Parameters!DateTo.Value)*100+day(Parameters!DateTo.Value) & "Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
-
In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???
select ......
whereand F2TRDT >= " & Year(Parameters!DateFrom.Value)*10000+Month(Parameters!DateFrom.Value)*100+day(Parameters!DateFrom.Value) & "
and F2TRDT <= " & Year(Parameters!DateTo.Value)*10000+Month(Parameters!DateTo.Value)*100+day(Parameters!DateTo.Value) & "Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
-
In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???
select ......
whereand F2TRDT >= " & Year(Parameters!DateFrom.Value)*10000+Month(Parameters!DateFrom.Value)*100+day(Parameters!DateFrom.Value) & "
and F2TRDT <= " & Year(Parameters!DateTo.Value)*10000+Month(Parameters!DateTo.Value)*100+day(Parameters!DateTo.Value) & "Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
Oh, I see your point: that guy was assuming a month could have upto 99 days, and a year upto 99 months, and thus was waisting many numbers, and his formula will soon hit the limits of an Int32. He'd better do a
and F2TRDT >= " & Year(Parameters!DateFrom.Value)*372+Month(Parameters!DateFrom.Value)*31+day(Parameters!DateFrom.Value) & "
and F2TRDT <= " & Year(Parameters!DateTo.Value)*372+Month(Parameters!DateTo.Value)*31+day(Parameters!DateTo.Value) & "which still waists some 6 or 7 days per year.
-
Oh, I see your point: that guy was assuming a month could have upto 99 days, and a year upto 99 months, and thus was waisting many numbers, and his formula will soon hit the limits of an Int32. He'd better do a
and F2TRDT >= " & Year(Parameters!DateFrom.Value)*372+Month(Parameters!DateFrom.Value)*31+day(Parameters!DateFrom.Value) & "
and F2TRDT <= " & Year(Parameters!DateTo.Value)*372+Month(Parameters!DateTo.Value)*31+day(Parameters!DateTo.Value) & "which still waists some 6 or 7 days per year.
It is not about converting into integer number... The date needs to be in yyyyMMdd format.. The whole point is why not use Foramt() function...
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
-
It is not about converting into integer number... The date needs to be in yyyyMMdd format.. The whole point is why not use Foramt() function...
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
... I'd better have marked my post as a joke ...
-
In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???
select ......
whereand F2TRDT >= " & Year(Parameters!DateFrom.Value)*10000+Month(Parameters!DateFrom.Value)*100+day(Parameters!DateFrom.Value) & "
and F2TRDT <= " & Year(Parameters!DateTo.Value)*10000+Month(Parameters!DateTo.Value)*100+day(Parameters!DateTo.Value) & "Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
-
It is not about converting into integer number... The date needs to be in yyyyMMdd format.. The whole point is why not use Foramt() function...
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
virang_21 wrote:
The whole point is why not use Foramt() function...
Is that similar to the Format() function? :-D :laugh:
Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!