Is there a simple way to make Sequelize return it's date/time fields in a particular format?
- 阅读更多 关于 Is there a simple way to make Sequelize return it's date/time fields in a particular format?
问题 We need to have sequelize return dates in a particular format, not the default one. As far as I can tell, there is no way to set that up in options, or any other way. Short of manually updating the dates every time after they are retrieved, anyone been able to solve this easily? Or am I missing something? 回答1: you can define custom instance methods getDate/setDate which would translate date between sequelize internal representation and desired format like so http://sequelize.readthedocs.org