Small modification to get_datetime