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. to display date in repeater in MM.dd.yyyy format

to display date in repeater in MM.dd.yyyy format

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

    Hi, i have to extract datetime field of table in database stored in mm/dd/yyyy 12:00:00 and display it in repeater in MM.dd.yyyy format. Time should not be displayed ,date should be displayed in MM.dd.yyyy foemat only that is having dots not slashes. How can i achieve it? Is there any function in SQL to convert date format?.Please guide.

    yog hui gfgh kgdgrt njjn hjgkn

    E E 2 Replies Last reply
    0
    • Y yogita charhate

      Hi, i have to extract datetime field of table in database stored in mm/dd/yyyy 12:00:00 and display it in repeater in MM.dd.yyyy format. Time should not be displayed ,date should be displayed in MM.dd.yyyy foemat only that is having dots not slashes. How can i achieve it? Is there any function in SQL to convert date format?.Please guide.

      yog hui gfgh kgdgrt njjn hjgkn

      E Offline
      E Offline
      Elina Blank
      wrote on last edited by
      #2

      Try this: DateTime myDate = dateFromDB; string myDateStringForm = myDate.ToString("mm.dd.yyyy");

      Sincerely, Elina Life is great!!! Enjoy every moment of it! :-O

      I 1 Reply Last reply
      0
      • Y yogita charhate

        Hi, i have to extract datetime field of table in database stored in mm/dd/yyyy 12:00:00 and display it in repeater in MM.dd.yyyy format. Time should not be displayed ,date should be displayed in MM.dd.yyyy foemat only that is having dots not slashes. How can i achieve it? Is there any function in SQL to convert date format?.Please guide.

        yog hui gfgh kgdgrt njjn hjgkn

        E Offline
        E Offline
        Eric Dahlvang
        wrote on last edited by
        #3
        replace(convert(varchar,getdate(),101),'/','.')
        

        --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

        1 Reply Last reply
        0
        • E Elina Blank

          Try this: DateTime myDate = dateFromDB; string myDateStringForm = myDate.ToString("mm.dd.yyyy");

          Sincerely, Elina Life is great!!! Enjoy every moment of it! :-O

          I Offline
          I Offline
          Iridania
          wrote on last edited by
          #4

          i dont want to save it as an string i want to handle it as date how do you do that?

          La Light

          E 1 Reply Last reply
          0
          • I Iridania

            i dont want to save it as an string i want to handle it as date how do you do that?

            La Light

            E Offline
            E Offline
            Elina Blank
            wrote on last edited by
            #5

            You need a string if you are binding it to a Text property of the control. If you do not want to declare a string variable, do it in one line: myControl.Text = myDate.ToString("MM.dd.yyyy");

            Sincerely, Elina Life is great!!! Enjoy every moment of it! :-O

            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