substr
accepts $string, $start, and an optional $length. Try using 2 instead of 6 in both month and day.
Aaron Hathaway
2010-10-29 18:35:48
substr
accepts $string, $start, and an optional $length. Try using 2 instead of 6 in both month and day.
PHP's substr is string substr ( string $string , int $start [, int $length ] )
So your code should read as:
print(substr($now, 0, 4)); //year
print(' ');
print(substr($now, 4, 2)); //month
print(' ');
print(substr($now, 6, 2)); //day