Move a function that uses localtime to helper class