I'm fetching GPS data to display on a Google map in a Rails 2.3.8 app.
The timestamp for each data point is 开发者_如何学Pythonin this format:
2011-08-14T09:23:11.000Z
I need to get that into MySQL as a DATETIME object so I can then sort and filter the track points by time.
Any suggestions?
ActiveRecord usually will convert this for you when you save your object into the database. If for some reason, you're bypassing AR, you can convert it to db format via:
"2011-08-14T09:23:11.000Z".to_s(:db)
Time.parse "2011-08-14T09:23:11.000Z"
精彩评论