Question about SQLite database's valid_upto field

Thomas Baumgart thb at net-bembel.de
Wed Jun 10 13:01:25 BST 2020


Prasun,

On Mittwoch, 10. Juni 2020 03:37:19 CEST Prasun Kumar wrote:

[...]

> Is there a specific reason why you convert the date into a numeric value
> > (julianday()) and don't use the SQLite date type?
> 
> SQLite does not have a DATE type.
> >From https://www.sqlite.org/datatype3.html :
> 
> > SQLite does not have a storage class set aside for storing dates and/or
> > times. Instead, the built-in Date And Time Functions
> > <https://www.sqlite.org/lang_datefunc.html> of SQLite are capable of
> > storing dates and times as TEXT, REAL, or INTEGER values:
> >
> >    - *TEXT* as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS").
> >    - *REAL* as Julian day numbers, the number of days since noon in
> >    Greenwich on November 24, 4714 B.C. according to the proleptic Gregorian
> >    calendar.
> >    - *INTEGER* as Unix Time, the number of seconds since 1970-01-01
> >    00:00:00 UTC.
> >
> > Applications can chose to store dates and times in any of these formats
> > and freely convert between formats using the built-in date and time
> > functions <https://www.sqlite.org/lang_datefunc.html>.
> >
> Since I have to compare the validity date with the current date while
> reading data in the library code, so I thought TEXT was not a good idea. I
> looked online and saw REAL being used more often than INTEGER. So chose
> REAL.

Ah, OK, did not know that. I was just looking at the .schema output of a
KMyMoney table that contains date information and found this:

sqlite> .schema kmmTransactions  

now you know why I asked for the 'SQLite date type'.

Regards

Thomas


-- 

Regards

Thomas Baumgart

https://www.signal.org/       Signal, the better WhatsApp
-------------------------------------------------------------
Testing can only prove the presence of bugs, not their absence.
 -- Edsger W. Dijkstra, 1969
-------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-finance-apps/attachments/20200610/4db6d33f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-finance-apps/attachments/20200610/4db6d33f/attachment.sig>


More information about the Kde-finance-apps mailing list