Gilles Ganault wrote:
> Before I go ahead and write a script to loop through all the rows, I
> was wondering if SQLite supports functions to convert DD MM YYYY into
> the MySQL-friendly YYYY-MM-DD, and whether those functions are
> localized so that it understands month names in languages other than
> English?

SQLite supports such functions in the sense that you can write a custom 
function that does anything you want, and use it in your statements.

> Here's an example:
>
> SELECT dateinscription, dateconnexion FROM membres LIMIT 1;
> 26 Mai 2007|17 Août 2009 - 09h20
>
> I'd like to update the row into "2007-05-26" and "2009-08-17 09:20",
> respectively.

If you need to do it once, you can do something like

update membres set dateinscription=
    substr(dateinscription, -4) || '-' ||
    (case substr(dateinscription, 4, length(dateinscription) - 8)
     when 'January' then '01' when 'February' then '02' ...
     when 'December' then '12' end) || '-' ||
    substr(dateinscription, 1, 2);

Substitute correct month names. Converting dateconnexion is left as an 
exercise for the reader.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to