use POSIX 'strftime'; $now = lc strftime("%d/%m/%y %H:%M:%S", localtime); $hourago = lc strftime("%d/%m/%y %H:%M:%S", localtime(time - 3600) );