Try
Var updatedOn As DateTime
updatedOn = row.Column("UpdatedOn").DateTimeValue
// Do something...
Catch e As TypeMismatchException
System.DebugLog("Error on converting " + row.Column("UpdatedOn").StringValue + " to DateTime")
End Try
It will produce this output:
Error on converting 2022-01-15 11:17:29.148 to DateTime
Error on converting 2022-02-03 08:50:42.413 to DateTime
Error on converting 2022-02-03 08:51:34.482 to DateTime
On my database UpadedOn column is maintained by a trigger like this
CREATE TRIGGER IF NOT EXISTS Document_After_Update_Trigger
AFTER INSERT ON Document
BEGIN
UPDATE Document SET UpdatedOn = STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') WHERE id = NEW.id;
END;
I don’t find explanation on the documentation. Please can somebody help me ?
What wrote those dates? They’re not the SQLDateTime format that Xojo uses. It would be more prudent to find out why the dates are being written wrong than it would be to patch them to readability every time.
Thank you @Tim_Parnell I need nano seconds in my db so I will do things differently without using DateTimeValue
For those who don’t need nano seconds you can must use a trigger like this :
CREATE TRIGGER IF NOT EXISTS Document_After_Update_Trigger
AFTER INSERT ON Document
BEGIN
UPDATE Document SET UpdatedOn = STRFTIME('%Y-%m-%d %H:%M:%S', 'NOW') WHERE id = NEW.id;
END;