Página 1 de 1

Sqlite : What is proper practice to store Date field ?

Publicado: Vie Sep 19, 2014 1:40 pm
por Milan Mehta
Sqlite normally stores data as numeric value in the database. Xailer gives us the option to store the date value as numeric value (as default for sqlite) or store it date as character sting.
My question what is proper and prevalent method of storing Dates in Sqlite ? As Numeric Value or as Date character string ?
If we go for Date as character string, does it allow to operate on it like add or deduct days to it ?
Kindly guide and oblige.
Milan.

Sqlite : What is proper practice to store Date field ?

Publicado: Vie Sep 26, 2014 11:00 am
por jfgimenez
Milan,
sorry for the delay.
> Sqlite normally stores data as numeric value in the
> database. Xailer gives us the option to store the date value
> as numeric value (as default for sqlite) or store it date as
> character sting.
>
> My question what is proper and prevalent method of storing
> Dates in Sqlite ? As Numeric Value or as Date character
> string ?
>
> If we go for Date as character string, does it allow to
> operate on it like add or deduct days to it ?
When Xailer added support for SQLite, several years ago, SQLite didn't
support dates as a native data type. So, we decided to do so, by adding
it as numeric julian-day values. That way, it's possible to add to or
substract days from any date value.
Later, SQLite added *limited* support for date values, but they decided
to do it by using strings in ISO format (yyyy-mm-dd).
Now, Xailer support both ways, by switching the property lDateAsString
in the datasource. However, only strings are supported by other SQLite
browsers.
BTW, I use to set lDateAsString to .T. in my own programs.
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info

Sqlite : What is proper practice to store Date field ?

Publicado: Lun Oct 06, 2014 4:27 pm
por Milan Mehta
Thanks a lot. I too started working keeping lDateAsString := .T. and the result is encouraging.
Regards,
Milan.