B4J Question Error using <strftime> in SQLite with B4J

Mariano Ismael Castro

Active Member
Licensed User
Hi, I'm trying to display a time that is in 24 hour format to a 12 hour format. To do this conversion I'm trying to use SQLite's <strftime> but I can't get it to work in B4J. There is no error, the query simply returns <null>. It's worth mentioning that if I test the query in other programs to manage SQLite databases, this query works.
I'm attaching an example in case someone can help me, regards.
 

Attachments

  • TestQuerySQLite.zip
    20.3 KB · Views: 9

drgottjr

Expert
Licensed User
Longtime User
your hora_temp format (03:10:00) is wrong. that's why you get null's
you either have to store the times in a format that sqlite understands or write your own routine to convert the hora_temp fields to the format you want.
check the sqlite dox.
sqlite accepts:
ISO-8601 A text string that is an ISO 8601 date/time value. Example: '2025-05-29 14:16:00'
Julian day number The number of days including fractional days since -4713-11-24 12:00:00 Example: 2460825.09444444
Unix timestamp The number of seconds including fractional seconds since 1970-01-01 00:00:00 Example: 1748528160

your format is not understood.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
your hora_temp format (03:10:00) is wrong. that's why you get null's
you either have to store the times in a format that sqlite understands or write your own routine to convert the hora_temp fields to the format you want.
check the sqlite dox.
sqlite accepts:
ISO-8601 A text string that is an ISO 8601 date/time value. Example: '2025-05-29 14:16:00'
Julian day number The number of days including fractional days since -4713-11-24 12:00:00 Example: 2460825.09444444
Unix timestamp The number of seconds including fractional seconds since 1970-01-01 00:00:00 Example: 1748528160

your format is not understood.
No, that format, hh:mm:ss, is correct, even for SQLite. A newer library was needed; in fact, changing libraries, the project returns correct values, not nulls.
 
Upvote 0
Top