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. Changing DateTime format of a gridview column

Changing DateTime format of a gridview column

Scheduled Pinned Locked Moved ASP.NET
question
5 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.
  • J Offline
    J Offline
    johland
    wrote on last edited by
    #1

    Hi I have a GridView that initializes when page is load,its data source is a DataSet. One of the columns is in a DateTime type, how can i change its type or alternately its DateTime format. Thanks in advance, Yohay

    C A A 3 Replies Last reply
    0
    • J johland

      Hi I have a GridView that initializes when page is load,its data source is a DataSet. One of the columns is in a DateTime type, how can i change its type or alternately its DateTime format. Thanks in advance, Yohay

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

      By not using auto generated columns, so you can specify a format string

      Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

      J 1 Reply Last reply
      0
      • J johland

        Hi I have a GridView that initializes when page is load,its data source is a DataSet. One of the columns is in a DateTime type, how can i change its type or alternately its DateTime format. Thanks in advance, Yohay

        A Offline
        A Offline
        AhsanS
        wrote on last edited by
        #3

        if you are assigning it data from database then when you are binding you can change the format like this. DateTime.ToString("dd MMM, yyyy HH:mm:ss");

        Ahsan Ullah Senior Software Engineer

        1 Reply Last reply
        0
        • C Christian Graus

          By not using auto generated columns, so you can specify a format string

          Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

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

          Does it means that I need to manually create custom columns for all columns within the DataSet's table? thanks again for your help yohay

          1 Reply Last reply
          0
          • J johland

            Hi I have a GridView that initializes when page is load,its data source is a DataSet. One of the columns is in a DateTime type, how can i change its type or alternately its DateTime format. Thanks in advance, Yohay

            A Offline
            A Offline
            Anudeep Jaiswal
            wrote on last edited by
            #5
            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