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. Database & SysAdmin
  3. Database
  4. date issue

date issue

Scheduled Pinned Locked Moved Database
questioncsharpmcphelp
8 Posts 4 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.
  • T Offline
    T Offline
    Tauseef A
    wrote on last edited by
    #1

    hi guys i want to get date values from my table in format like October-09 how can i do that ? regards.

    Tauseef A Khan MCP Dotnet framework 2.0.

    L I 3 Replies Last reply
    0
    • T Tauseef A

      hi guys i want to get date values from my table in format like October-09 how can i do that ? regards.

      Tauseef A Khan MCP Dotnet framework 2.0.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Tauseef A wrote:

      i want to get date values from my table in format like October-09

      Date values have no format, they are just numbers. It is only when they are displayed that you apply whatever format you want.

      Tauseef A wrote:

      MCP Dotnet framework 2.0.

      :confused:

      1 Reply Last reply
      0
      • T Tauseef A

        hi guys i want to get date values from my table in format like October-09 how can i do that ? regards.

        Tauseef A Khan MCP Dotnet framework 2.0.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Tauseef A wrote:

        i want to get date values from my table in format like October-09

        You can use the below queries SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS [Month DD] SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), ' ', '-') AS [Mon-YYYY] For more information kindly refer to link http://www.sql-server-helper.com/tips/date-formats.aspx[^]

        Regards Aman Bhullar www.arlivesupport.com[^]

        J 1 Reply Last reply
        0
        • L Lost User

          Tauseef A wrote:

          i want to get date values from my table in format like October-09

          You can use the below queries SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS [Month DD] SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), ' ', '-') AS [Mon-YYYY] For more information kindly refer to link http://www.sql-server-helper.com/tips/date-formats.aspx[^]

          Regards Aman Bhullar www.arlivesupport.com[^]

          J Offline
          J Offline
          J4amieC
          wrote on last edited by
          #4

          Aman Bhullar wrote:

          SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS [Month DD] SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), ' ', '-') AS [Mon-YYYY]

          :confused: Neither of these give the OP what they asked for. The first gives "October 21" the second "Oct-2009"

          L 1 Reply Last reply
          0
          • T Tauseef A

            hi guys i want to get date values from my table in format like October-09 how can i do that ? regards.

            Tauseef A Khan MCP Dotnet framework 2.0.

            I Offline
            I Offline
            i i i
            wrote on last edited by
            #5

            On front end what tool are you using , try this might be helpful http://www.codeguru.com/csharp/csharp/cs_date_time/formatting/article.php/c4205/[^] http://blogs.msdn.com/kathykam/archive/2006/09/29/.NET-Format-String-102_3A00_-DateTime-Format-String.aspx[^] plus you did not went to US

            Best Regards, SOFTDEV If you have knowledge, let others light their candles at it

            1 Reply Last reply
            0
            • J J4amieC

              Aman Bhullar wrote:

              SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS [Month DD] SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), ' ', '-') AS [Mon-YYYY]

              :confused: Neither of these give the OP what they asked for. The first gives "October 21" the second "Oct-2009"

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Try using SELECT DATENAME(MM, GETDATE()) + ' ' + RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR(4)), 2) AS [Month YY] This will give the result in the desired format

              Regards Aman Bhullar www.arlivesupport.com[^]

              I 1 Reply Last reply
              0
              • L Lost User

                Try using SELECT DATENAME(MM, GETDATE()) + ' ' + RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR(4)), 2) AS [Month YY] This will give the result in the desired format

                Regards Aman Bhullar www.arlivesupport.com[^]

                I Offline
                I Offline
                i i i
                wrote on last edited by
                #7

                casting will make it slow

                Best Regards, SOFTDEV If you have knowledge, let others light their candles at it

                L 1 Reply Last reply
                0
                • I i i i

                  casting will make it slow

                  Best Regards, SOFTDEV If you have knowledge, let others light their candles at it

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  But there is no direct way to get the date in the desired format

                  Regards Aman Bhullar www.arlivesupport.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