Recent

Author Topic: SQLite3Connection e os campos date - 24-09-2012 -> 2456194.5  (Read 3929 times)

cavaco

  • Newbie
  • Posts: 6
SQLite3Connection e os campos date - 24-09-2012 -> 2456194.5
« on: September 24, 2012, 10:43:21 am »
Bom dia

Estou a utilizar o SQLite3Connection1 e os campos de date ficam gravados como valor numérico.

Pedia ajuda para o que posso fazer para por ex. a data  24-09-2012 fique assim gravada na tabela e não o que e está a acontecer que é ficar  2456194.5

(não sei se é importante mas estou a usar a versão 1 em ubuntu)

Os meus agradecimentos



Lacak2

  • Guest
Re: SQLite3Connection e os campos date - 24-09-2012 -> 2456194.5
« Reply #1 on: September 24, 2012, 01:13:00 pm »
I answer in english.

TSQLite3Connection when storing datetime values, uses REAL format of data, which represents according to http://www.sqlite.org/datatype3.html#datetime
"Julian day numbers, the number of days since noon in Greenwich on November 24, 4714 B.C." to 24-09-2012

Try use :
select date(<your_datetime_column>) from <your_table>
and you will see correct date.

cavaco

  • Newbie
  • Posts: 6
Re: SQLite3Connection e os campos date - 24-09-2012 -> 2456194.5
« Reply #2 on: September 24, 2012, 04:33:51 pm »
Thank you for your answer!

In the program Lazarus, I can see correctly the date but as you can see by the image, when I consult the table by another way (for example sqliteManager) I  notice that in the previous program (that was made trought zeos), the date is correct and now appears in numerical form.

Thank you again for your help!

Lacak2

  • Guest
Re: SQLite3Connection e os campos date - 24-09-2012 -> 2456194.5
« Reply #3 on: September 25, 2012, 08:46:40 am »
Yes it is expected. I guess, that Zeos write datetime values as string (in format YYYY-MM-DD HH:NN:SS) into SQLite so if you determine column afinity it will be TEXT.
(TSQLite3Connection writes datetime values as REAL ... it is difference)

Try do:
select typeof(Data), datetime(Data) from ApiReceitas

 

TinyPortal © 2005-2018