我正在尝试将标准的rails DB字段created_at和updated_at转换为atom提要rfc3339格式。到目前为止,我已经尝试过:
DateTime.rfc3339(issue.updated_at)和
DateTime.parse(issue.updated_at).rfc3339两次我都得到了:
no implicit conversion of ActiveSupport::TimeWithZone into String如果我尝试在w3.org上验证我的atom提要,我会得到以下消息:
updated must be an RFC-3339 date-time: 2013-06-27 13:42:34 UTC以上错误是针对所有数据库updated_at字段的。当我像下面这样创建提要更新处字段时,我没有得到任何错误:
xml.updated(Time.now.xmlschema)我已经到处找过了,也没有解决这个问题。我确实找到了Convert db date to rfc3339,但这对我不起作用。
有什么想法吗?
发布于 2013-07-02 23:46:45
尝试:
issue.updated_at.to_datetime.rfc3339https://stackoverflow.com/questions/17429707
复制相似问题