On Mar 17, 2005, at 11:40 AM, Clark Christensen wrote:
Probably off-topic for a SQLite list :-)
I'm not sure Perl will cast a non-numeric string ("2005-03-22T00:00:00") to a number. What number are you looking for?
Actually the code that was cast was "substr(a, 6, 2)", which was evaluating to "03", and I wanted it to be just 3, because when I bind "03" in DBD::SQLite, it changes it to 3.
If you were looking for 20050322, SQLite can do that for you, too. Have a look at http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions
I wasn't looking for 20050322, but I'm thrilled to have the pointers to SQLite's date/time functions. I should be able to change "substr(a, 6, 2)" to "strftime("%m", a)" and then not have to cast.
...hrm, nope. "strftime("%m", a)" still produces "03" instead of just "3". So I have to do "strftime("%m", a)+0". And strftime doesn't support the ISO-8601 format "YYYY-MM-DDTHH:MM:SS" (note the "T") :-(
But aside from that, I'd still like to see unary + be able to cast '03' to 3.
Thanks,
David