fixed java time formatting logic, added more tests