Charly Caulet <[EMAIL PROTECTED]>
wrote:
CREATE TRIGGER tstpTOdate1 AFTER INSERT ON contrat
BEGIN
  UPDATE contrat SET date1=strftime("%d-%m-%Y", new.tstp) WHERE
UniqueID=new.UniqueID;
END;

But when strftime doesn't seem to work :
INSERT INTO contrat(tstp) VALUES("1184834152");
SELECT * FROM contrat;
1|1184834152|16-08-3239253

I'm not sure what 1184834152 is supposed to represent, but strftime interprets it as a Julian day number. (1184834152 / 365) is somewhere around 3246120, so the year looks about right.

You probably want

   strftime('%d-%m-%Y', new.tstp, 'unixepoch')

For more details, see http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to