[TIP] Extracting some part of date, time and datetime values.

Ivan Smahin IvanSmahin at public.kherson.ua
Sat May 14 21:37:29 CDT 2005


Hello All,

Don't use such code:

>> db.sqlExecute("update students set logged_in = substr(curdate(), 1, 4) where
>> (ID = '4')");

Because of:

1. We have a number of DateTime based SQL functions like YEAR(),
MONTH()...
2. The string representation for such values may differ depending on
current DateTime format. So it's just unsafe.




-- 
Best regards,
 Ivan                            mailto:IvanSmahin at public.kherson.ua



More information about the Valentina mailing list