SQLite Forum

Timeline
Login

2 forum posts by user maassg

2021-03-13
14:58 Reply: Feature request: pragma for changing the precision / format of CURRENT_TIMESTAMP to YYYY-MM-SSTHH:MM:SS.SSS (artifact: 80b03c07ee user: maassg)

Hello Ryan, you got me wrong. Let me clarify my argumentation.

Not the function strftime itself is clumsy, but the SQL interface is

when the user has to use it instead of CURRENT_TIMESTAMP.

That's why CURRENT_TIMESTAMP exists

and it should give you a timestamp with maximum possible precision.

This is how it works in all major sql database systems.

best regards

2021-03-06
10:30 Post: Feature request: pragma for changing the precision / format of CURRENT_TIMESTAMP to YYYY-MM-SSTHH:MM:SS.SSS (artifact: 8adfe2fded user: maassg)

create table TEST ( mtime timestamp default CURRENT_TIMESTAMP );

or select CURRENT_TIMESTAMP;

currently always returns datetime value as "YYYY-MM-DD HH:MM:SS"

but I would like it like this: "YYYY-MM-DDTHH:MM:SS.SSS"

the workaround "strftime( '%Y-%m-%dT%H:%M:%fZ', 'now' )" is a bit clumsy:

create table TEST ( mtime timestamp default( strftime( '%Y-%m-%dT%H:%M:%fZ', 'now' ) ) );

or select strftime( '%Y-%m-%dT%H:%M:%fZ', 'now' );

thanks a lot with best regards

maassg