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. fetch date and time separately from datetime field in C#.net

fetch date and time separately from datetime field in C#.net

Scheduled Pinned Locked Moved ASP.NET
csharpdatabaseasp-netquestion
4 Posts 2 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
    ships_agr
    wrote on last edited by
    #1

    i want to fetch time and date information separately from a datetime type field of a table created using sql 2005 of asp.net...i wasn't able to understand the pages displayed on google for the same query...??

    T 1 Reply Last reply
    0
    • S ships_agr

      i want to fetch time and date information separately from a datetime type field of a table created using sql 2005 of asp.net...i wasn't able to understand the pages displayed on google for the same query...??

      T Offline
      T Offline
      Tarakeshwar Reddy
      wrote on last edited by
      #2

      Not sure if I understood your question correctly. You can use the convert method and pass in the style. You can get the date by using styles 101 to 107 and 108 or 114 to get the time part. This MSDN article[^] provides you with the syntax and shows the output for the various styles.


      Tarakeshwar Reddy There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi

      S 1 Reply Last reply
      0
      • T Tarakeshwar Reddy

        Not sure if I understood your question correctly. You can use the convert method and pass in the style. You can get the date by using styles 101 to 107 and 108 or 114 to get the time part. This MSDN article[^] provides you with the syntax and shows the output for the various styles.


        Tarakeshwar Reddy There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi

        S Offline
        S Offline
        ships_agr
        wrote on last edited by
        #3

        i've used a gridview datasource control to display the schedule ....thr in i've specified the time field as datetime datatype in the table....nw when i'm displaying the page along with time, date is also being displayed...i don want to display the date....but only time....can you help me...???

        T 1 Reply Last reply
        0
        • S ships_agr

          i've used a gridview datasource control to display the schedule ....thr in i've specified the time field as datetime datatype in the table....nw when i'm displaying the page along with time, date is also being displayed...i don want to display the date....but only time....can you help me...???

          T Offline
          T Offline
          Tarakeshwar Reddy
          wrote on last edited by
          #4

          You can use a bound field and set the DataFormatString.

          Take a look at the Standard DateTime Format Strings [^] and this article[^] which shows you how to create a bound field.


          Tarakeshwar Reddy There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi

          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