Android Question convert datevalue in the db query

Roberto P.

Well-Known Member
Licensed User
Longtime User
I'm trying to convert the value of a date field from a query (number-to-string) starting from the example of the form dbutils, but it does not work because it returns always the numeric field. here is the code snippet:

sQuery.Append("SELECT [DocNo] AS Numero Fattura, Date(DocumentDate / 1000, 'unixepoch', 'localtime') AS Data......

what is wrong?
thank you very much
roberto
 

Roberto P.

Well-Known Member
Licensed User
Longtime User
ciao Erel, il db è SqlLite. Ho trovato le capacità di formattazione. I post nel caso sia utile a qualcuno.
grazie

sQuery.Append (", strftime ('% d /% m /% Y', DocumentDate / 1000, 'unixepoch') come dati")
sQuery.Append (", strftime ('% Y', DocumentDate / 1000, 'unixepoch') AS Anno")
sQuery.Append (", strftime ('% m', DocumentDate / 1000, 'unixepoch') AS Mese")
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…