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. Web Development
  3. ASP.NET
  4. Retrieve time from SQL

Retrieve time from SQL

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasesql-servertutorial
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.
  • S Offline
    S Offline
    sarvanjonty
    wrote on last edited by
    #1

    I am using MSSQL as my backend for ASP.Net.I have to retrieve time from SQL to ASP.Net textbox. The datatype of the field is smalldatetime. The value stored in it is "1/1/1900 12:20:00".How to Retrieve the time "12:20:00" from the field.

    Sarvan.M

    G M S 3 Replies Last reply
    0
    • S sarvanjonty

      I am using MSSQL as my backend for ASP.Net.I have to retrieve time from SQL to ASP.Net textbox. The datatype of the field is smalldatetime. The value stored in it is "1/1/1900 12:20:00".How to Retrieve the time "12:20:00" from the field.

      Sarvan.M

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      You can format the DateTime value into a string with only the time: timeString = daTime.ToString("HH':'mm':'ss");

      --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • S sarvanjonty

        I am using MSSQL as my backend for ASP.Net.I have to retrieve time from SQL to ASP.Net textbox. The datatype of the field is smalldatetime. The value stored in it is "1/1/1900 12:20:00".How to Retrieve the time "12:20:00" from the field.

        Sarvan.M

        M Offline
        M Offline
        mbbisht
        wrote on last edited by
        #3

        DateTime dtTime=Convert.ToDateTime(dateTime); string strTime=dtTime.ToLongTimeString();

        Mahendra

        1 Reply Last reply
        0
        • S sarvanjonty

          I am using MSSQL as my backend for ASP.Net.I have to retrieve time from SQL to ASP.Net textbox. The datatype of the field is smalldatetime. The value stored in it is "1/1/1900 12:20:00".How to Retrieve the time "12:20:00" from the field.

          Sarvan.M

          S Offline
          S Offline
          saloni289
          wrote on last edited by
          #4

          In MSSQL use Convert function:- convert(varchar,date,108)

          Saloni

          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