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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Date Format dd/mm/yyyy in mysql

Date Format dd/mm/yyyy in mysql

Scheduled Pinned Locked Moved C#
mysqlhelptutorialquestion
5 Posts 3 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.
  • F Offline
    F Offline
    fahiemulleh
    wrote on last edited by
    #1

    Hi all. I am developing application using vs2005 and mysql5.0. The problem is I want to store date as dd/mm/yyyy which mysql doesn't allow me to store. Please suggest a way how to do that? I will be very thankful to you.

    L R 2 Replies Last reply
    0
    • F fahiemulleh

      Hi all. I am developing application using vs2005 and mysql5.0. The problem is I want to store date as dd/mm/yyyy which mysql doesn't allow me to store. Please suggest a way how to do that? I will be very thankful to you.

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      fahiemulleh wrote:

      mysql doesn't allow me to store

      Databases store dates in binary form. What you refer to is the output or display or "formatting" of the date after you obtain the date information from the database.

      led mike

      F 1 Reply Last reply
      0
      • F fahiemulleh

        Hi all. I am developing application using vs2005 and mysql5.0. The problem is I want to store date as dd/mm/yyyy which mysql doesn't allow me to store. Please suggest a way how to do that? I will be very thankful to you.

        R Offline
        R Offline
        Rob Graham
        wrote on last edited by
        #3

        I think you are confusing the display format and the storage format. Most databases store datetime as a numeric value, tipically milliseconds since some starting date/time. How that date gets formatted for display is up to your UI code. if your locale settings are not appropriate for the dd/mm/yyyy display format, it likely can't reliably covert that string to a datetime. Since you are using ADO.Net, you should just use a parameterized insert/update query, and provide the date as a DateTime value, rather than a string. If you want to accept that format from your UI , just specify an appropriate IFormatProvider and DateTimeStyle to the DateTime.Parse method.

        1 Reply Last reply
        0
        • L led mike

          fahiemulleh wrote:

          mysql doesn't allow me to store

          Databases store dates in binary form. What you refer to is the output or display or "formatting" of the date after you obtain the date information from the database.

          led mike

          F Offline
          F Offline
          fahiemulleh
          wrote on last edited by
          #4

          so Please tell me How to format date (for display) as dd/mm/yyyy.

          L 1 Reply Last reply
          0
          • F fahiemulleh

            so Please tell me How to format date (for display) as dd/mm/yyyy.

            L Offline
            L Offline
            led mike
            wrote on last edited by
            #5

            fahiemulleh wrote:

            so Please tell me How to format date

            They hide that information in the documentation[^] :rolleyes:

            led mike

            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