This should be handled using Drupal og PHP Date APIs - not string manipulation.