Re: [sqlite] Re: timestamp to date in a trigger

2007-07-20 Thread Charly Caulet
I didn't understood modifiers utility, reading this page
(http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions). Thank you
Igor and Richard for explainations and help.


> I'm not sure what 1184834152 is supposed to represent,
It is an UNIX timestamp (number of seconds since 1970).

> You probably want
>
> strftime('%d-%m-%Y', new.tstp, 'unixepoch')
It's exactly what I need.

Charly CAULET

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



[sqlite] Re: timestamp to date in a trigger

2007-07-19 Thread Igor Tandetnik

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]
-