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

Date Format

forums forums SQLyog Using SQLyog Date Format

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #10185
      Carlo
      Member

      I'm creating a simple web-based system which is able to write on a database through html form and jsp.

      I have a problem with the date: SQLyog uses datatype date in this format: 2007-02-15 –> year-month-day

      I need to use a different format, the typical european format: day-month-year –> 15-02-2007

      How can I do this in SQLyog? šŸ˜®

      thanks

    • #23423
      peterlaursen
      Participant

      You cannot do this in SQLyog. Ā Dates in MySQL is stored in the format of YYYY-MM-DD, and a client like SQLyog cannot change this.

      With web applications I think it is most common to use different (PHP/javascript) (string) functions to extract year, month and day and builld you own display format.

      However in SQL what you can is described here:

      http://dev.mysql.com/doc/refman/5.0/en/dat…-functions.html

      note the DATA_FORMAT() function and the lot for formatting string options available!

      An example:

      Code:
      set @the_current_date = '2007-02-16';
      select date_format(@the_current_date,'%e-%m-%Y');
      — this returns '16-02-2007'

      ThereĀ is no GUI functionality for this – you will need to write theĀ SQLĀ yourself.

      Also note that the above example (with user variables) will not work with HTTP tunnelling unless you use SQLyog 5.23 with php_mysqli() ).

Viewing 1 reply thread
  • You must be logged in to reply to this topic.