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. how to get only date from datetime field of te table

how to get only date from datetime field of te table

Scheduled Pinned Locked Moved Database
databasetutorialquestion
4 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.
  • Y Offline
    Y Offline
    yogita charhate
    wrote on last edited by
    #1

    hi,I have to display only date from the datetime field of table in DB, What function i should use in sql query? or Any other way? Please guide.

    yog hui gfgh kgdgrt njjn hjgkn

    C J 2 Replies Last reply
    0
    • Y yogita charhate

      hi,I have to display only date from the datetime field of table in DB, What function i should use in sql query? or Any other way? Please guide.

      yog hui gfgh kgdgrt njjn hjgkn

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If it's a question of display, your presentation layer should deal with it, not the DB.

      Christian Graus - C++ MVP

      1 Reply Last reply
      0
      • Y yogita charhate

        hi,I have to display only date from the datetime field of table in DB, What function i should use in sql query? or Any other way? Please guide.

        yog hui gfgh kgdgrt njjn hjgkn

        J Offline
        J Offline
        Janani Divya
        wrote on last edited by
        #3

        Use the following in stored procedure, convert(varchar,checkindate,101) as checkindate This will extract only 15/11/2006 only. For ur reference: checkindate --> Field in the table. Hope u will understand it.

        Janani

        L 1 Reply Last reply
        0
        • J Janani Divya

          Use the following in stored procedure, convert(varchar,checkindate,101) as checkindate This will extract only 15/11/2006 only. For ur reference: checkindate --> Field in the table. Hope u will understand it.

          Janani

          L Offline
          L Offline
          Laxmikant Lad
          wrote on last edited by
          #4

          if you want to extract only date you can use datepart function as SELECT DATEPART(month, GETDATE()) AS 'Month Number' but if you want to see full date u can use format = "d" or mm/dd/yyyy

          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