Hello. There is 1 table:

Base

Name - Text field

Surname - Text Box

birthdate - date

The form has a button , DateTimePicker and TableGrid .

The date on the TableGrid shown as dd.mm.yyyy . When pressed, the button goes the following SQL query:

 SELECT "$autoinc", Base.Name, Base.Surname, Base.birthdate FROM Base 

The result is displayed on the TableGrid as yyyy-mm-dd 00:00:00 . It is necessary that it was just dd.mm.yyyy . Help with the task please.

  • one
    Specify the implementation of sql: MySql, Oracle, MsSql ... If you are writing a program, specify the programming language. - Sanek Zhitnik

2 answers 2

Solution options:

  1. The ToShortDateString() property is a string with the format dd / mm / yyyy
  2. Manually obtain the fields $"{mydate.Day}.{mydate.Month}.{mydate.Year}" from the class

PS If the birthdate field is of type datetime , not date , then by default it will display the full date with time.

    In addition to the answer @Kryshtop

    You can also add formatting to the query (SQL Server)

      SELECT "$autoinc", Base.Name, Base.Surname, CONVERT(char(10), Base.birthdate, 104) AS birthdate FROM Base