Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Mysql Date Format

forums forums Mysql Date Format

  • This topic is empty.
Viewing 3 reply threads
  • Author
    Posts
    • #9233
      peterlaursen
      Participant

      QUOTE
      Please tell me that if there is a way to change the date format stored in the database..its YYYY-MM-DD. i would like to change it to the DD-MM-YY.

    • #19224
      peterlaursen
      Participant

      You can read about MySQL date and time types here:

      http://dev.mysql.com/doc/mysql/en/date-and-time-types.html.

      Basically these variables are stored a strings. A datetime as a 14 character string. A date as an 8 character string.

      The functions to use on these variable types are described here:

      http://dev.mysql.com/doc/mysql/en/date-and…-functions.html

      (have a look in particular at the DATE_FORMAT(date,format) function)

      … but actually any string function will work too.

      I think you mismatch how a variable is stored and how it is displayed!

      The formatting string to use is '%d %m %y' to get all three as numericals and year in two-digit-format and in order day-month-year (like today 19-09-05).

    • #19225
      peterlaursen
      Participant

      Look at attached image.

      DATA-pane shows data with standard formatting

      In RESULT-pane you can format as you like with the date_format() function.

    • #19226
      peterlaursen
      Participant

      Or

      CODE
      select a as mynumber ,c as mystring , date_format(b,'%W %d-%m-%y') as mytimeway from mytable;

      returns

      QUOTE
      mynumber  mystring  mytimeway       


       


       


            1  aaaa      Monday 17-09-01 

            2  bbbb      Saturday 30-09-06

Viewing 3 reply threads
  • You must be logged in to reply to this topic.