SQLite and dates

@‚Taifun:

select Text, datetime(Datum, '-2 days') from Reminder where Status = 0 order by Datum

gives a null value:

And what do you get here

select Text, Datum from Reminder where Status = 0

Also provide your CREATE TABLE statement

Taifun

CREATE TABLE IF NOT EXISTS 'Reminder' ('id' INTEGER NOT NULL, 'Text' TEXT, 'vor' INTEGER, 'Status' INTEGER, 'Datum' TEXT, 'TST' TEXT, PRIMARY KEY('id'))

Taifun

I get ‚null‘

You already said that earlier, the question is

Taifun

just a text field with a date

The format of your Datum should be yyyy-mm-dd

Taifun

@Emanuel_Kury
You can use my extension

When my wife opens a box of pasta, she dumps it out onto a sheet of paper to check for creepy crawlers.

Only after verifying it is good, she pours it into the pot.
(She doesn't throw the box into the pot, as far as I can tell)

A good coder does the same with Web and data base output.

Use a global variable for the sheet of paper.

Here are some good tests:

  • Is a list?

  • Length of list greater than (0/1/2/...)?

  • Length of list of list item n?

To get leading zeros for 1 digit months and days you could use this procedure

Taifun

Ai2 by default renders lists and dictionaries as JSON text when you ask to output them in human readable form.

JSON gives you hints as to the original structure of the list or dictionary.
The nested [ marks tell you if it was a list. Nested [[ tells you it was a list of lists. Quote marks versus numbers without quote marks tell you if it was a number or text. { marks tell you it was a dictionary.

So if you return raw web or database returns into a Label.Text or the Do It of a global variable (better), you will have the mental tools needed to read and decipher the internal structure of what was returned.

  • a sharp eye, willing and able to spot what doesn't belong
  • imagination to visualize the flow of data over time and space
  • a mental catalog of the different ways data can assemble into data structures
  • a vocabulary to describe things and their attributes
  • numeracy, to distinguish between one and many
  • a firm grasp of Murphy's Law, and willingness to address the possibility that things can go wrong
  • courage to read code all the way through
  • knowing when to go back and read the docs

(What did I miss?)

Using SimpleSQLite extension, a simple example:

Jesus Christ
who can help ?




where, the hell, does 35975936 come from?

Trace the output from SQLite using Do It, block by block, working from top down, right to left.
Keep going until your blocks look like a pin cushion.

Firstly, mind your language...

Secondly, you appear to have left out the listFixer block when returning table data from sqlite db.

Thirdly, did you store your millis number in a TEXT field as indicated in my example, and as forewarned.

Why are you still storing the date as numbers?

EDIT: small correction: yyyy-MM-dd is the correct one, because MM is months and mm is minutes
Screenshot_20250912_144152_DuckDuckGo

Taifun

yes, here is my extension for your need- [Paid] Online Date Pro Extension | Unhackable Date | 100% Uptime | Create Subscription App | Show Live CountdownDays, Weeks Ago Pattern |