SQL: fixed .format() method to auto convert long in date