Left() in PHP
Posted: Sat Nov 12, 2005 12:32 pm
Hey,
I have a function that returns the timestamp from a database, first 8 characters..
Now, to get the year (first 4 characters), I'm currently using this code.
Surely there is a more elegant solution, I think using sprintf, but that function confuses the hell out of me 
Any suggestions?
Josh
I have a function that returns the timestamp from a database, first 8 characters..
Code: Select all
SELECT LEFT(daytime, 8) FROM logCode: Select all
$year = $dates['LEFT(daytime,8)'][0] . $dates['LEFT(daytime,8)'][1] . $dates['LEFT(daytime,8)'][2] . $dates['LEFT(daytime,8)'][3];Any suggestions?
Josh