Greetings and best wishes to all. Thank you for your help.
Another question from newbie....
There seems to be a conflict (probably my lack of understanding) between the B4A doc and the SQLite definitions of how a date field is stored.
Date fields in B4a are generated as Unix time (see Core def below) but the documentation indicates that it is too large to be stored in an Int field (see below) - it must be stored as long. The documentation for SQLite indicates that it should be stored as an Int (it could also be stored as text, but I guess I am trying to save room and there seems to be an advantage in storing the date in native form, i.e., in Unix format).
QUESTION
When I create a SQLite DB table in B4A, how should I define the date field - int, long, and definitely not float (this would create a non Unix format which DateTime would not support). Would long be converted to Int in SQLite?
Documentation quote from Core and SQLite follows...
Core Library Definition
DateTime
Date and time related methods.
DateTime is a predefined object. You should not declare it yourself.
Date and time values are stored as ticks. Ticks are the number of milliseconds since January 1, 1970 00:00:00 UTC.
This value is too large to be stored in an Int variable. It should only be stored in a Long variable.
SQLite Definition
1.2 Date and Time Datatype
SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions 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.
Datatypes In SQLite Version 3
Another question from newbie....
There seems to be a conflict (probably my lack of understanding) between the B4A doc and the SQLite definitions of how a date field is stored.
Date fields in B4a are generated as Unix time (see Core def below) but the documentation indicates that it is too large to be stored in an Int field (see below) - it must be stored as long. The documentation for SQLite indicates that it should be stored as an Int (it could also be stored as text, but I guess I am trying to save room and there seems to be an advantage in storing the date in native form, i.e., in Unix format).
QUESTION
When I create a SQLite DB table in B4A, how should I define the date field - int, long, and definitely not float (this would create a non Unix format which DateTime would not support). Would long be converted to Int in SQLite?
Documentation quote from Core and SQLite follows...
Core Library Definition
DateTime
Date and time related methods.
DateTime is a predefined object. You should not declare it yourself.
Date and time values are stored as ticks. Ticks are the number of milliseconds since January 1, 1970 00:00:00 UTC.
This value is too large to be stored in an Int variable. It should only be stored in a Long variable.
SQLite Definition
1.2 Date and Time Datatype
SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions 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.
Datatypes In SQLite Version 3