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. General Programming
  3. C#
  4. issue with Date Format in SSRS

issue with Date Format in SSRS

Scheduled Pinned Locked Moved C#
helpsql-servercollaboration
5 Posts 3 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.
  • S Offline
    S Offline
    siddisagar
    wrote on last edited by
    #1

    Hi Team, I have two textboxes for taking startdate and enddate. If I give start date 10/01/2009 and Enddate 10/12/2009 then report should display 01st - 12th Oct'09 If start date is 10/02/2009 then it should display 02nd -12th Oct'09 Kindly help me

    S 1 Reply Last reply
    0
    • S siddisagar

      Hi Team, I have two textboxes for taking startdate and enddate. If I give start date 10/01/2009 and Enddate 10/12/2009 then report should display 01st - 12th Oct'09 If start date is 10/02/2009 then it should display 02nd -12th Oct'09 Kindly help me

      S Offline
      S Offline
      Saksida Bojan
      wrote on last edited by
      #2

      This question connect to other post Date Time String formats[^]

      String str1 = DateTime.Now.ToString("dd"); //12
      String str2;

      if (str1 == "01")
      str2 = "st"
      else if (str1 == "02")
      str2 = "nd";
      else if (str1 == "03")
      str2 = "rd";
      else
      str2 = "th";

      String str3 = DateTime.Now.ToString("MMM"); //Oct
      String str4 = DateTime.Now.ToString("yy"); //09

      String date = str1+str2+ " " + str3+ "'"+ str4; //12th Oct'09

      This task is dead easy. I showed how i did get custom format. Normal string formating doesn't show "st, nd, rd, th" (At least I think that whay) and doesn't allow chars as "'" Edit: Pre tags added

      B 1 Reply Last reply
      0
      • S Saksida Bojan

        This question connect to other post Date Time String formats[^]

        String str1 = DateTime.Now.ToString("dd"); //12
        String str2;

        if (str1 == "01")
        str2 = "st"
        else if (str1 == "02")
        str2 = "nd";
        else if (str1 == "03")
        str2 = "rd";
        else
        str2 = "th";

        String str3 = DateTime.Now.ToString("MMM"); //Oct
        String str4 = DateTime.Now.ToString("yy"); //09

        String date = str1+str2+ " " + str3+ "'"+ str4; //12th Oct'09

        This task is dead easy. I showed how i did get custom format. Normal string formating doesn't show "st, nd, rd, th" (At least I think that whay) and doesn't allow chars as "'" Edit: Pre tags added

        B Offline
        B Offline
        Blue_Boy
        wrote on last edited by
        #3

        Instead using else if I prefer using switch. :)


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

        S 1 Reply Last reply
        0
        • B Blue_Boy

          Instead using else if I prefer using switch. :)


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

          S Offline
          S Offline
          Saksida Bojan
          wrote on last edited by
          #4

          i woud use else if because it is small code. I would use Switch for bigger operation

          B 1 Reply Last reply
          0
          • S Saksida Bojan

            i woud use else if because it is small code. I would use Switch for bigger operation

            B Offline
            B Offline
            Blue_Boy
            wrote on last edited by
            #5

            I prefer switch for small and bigger cases.


            I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

            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