[Rails4] Fix `datetime.to_s(:db)`

`to_s` on `nil` requires zero parameters. Use `try` to bypass calling
`to_s` on `nil`