Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. How to conver Date to yyyyMMdd format in SSRS

How to conver Date to yyyyMMdd format in SSRS

Scheduled Pinned Locked Moved The Weird and The Wonderful
sql-servertutorialquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    virang_21
    wrote on last edited by
    #1

    In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???

    select ......
    where

    and 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.

    C B S 3 Replies Last reply
    0
    • V virang_21

      In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???

      select ......
      where

      and 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.

      C Offline
      C Offline
      csharpbd
      wrote on last edited by
      #2

      Nice thinking!:thumbsup:

      1 Reply Last reply
      0
      • V virang_21

        In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???

        select ......
        where

        and 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.

        B Offline
        B Offline
        Bernhard Hiller
        wrote on last edited by
        #3

        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.

        V 1 Reply Last reply
        0
        • B Bernhard Hiller

          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.

          V Offline
          V Offline
          virang_21
          wrote on last edited by
          #4

          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.

          B _ 2 Replies Last reply
          0
          • V virang_21

            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.

            B Offline
            B Offline
            Bernhard Hiller
            wrote on last edited by
            #5

            ... I'd better have marked my post as a joke ...

            1 Reply Last reply
            0
            • V virang_21

              In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???

              select ......
              where

              and 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.

              S Offline
              S Offline
              Sentenryu
              wrote on last edited by
              #6

              now i need some mind bleach, thanks.

              I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)

              1 Reply Last reply
              0
              • V virang_21

                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.

                _ Offline
                _ Offline
                _Damian S_
                wrote on last edited by
                #7

                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!!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups