ruby - 把string转换成datetime
访问量: 1746
# 这个是 Rails的 model.to_json 后,产生的默认的日期格式
my_string = '2019-06-29T16:35:45.000+08:00'
DateTime.strptime(my_string, "%Y-%m-%dT%H:%M:%S.%L%z")
访问量: 1746
# 这个是 Rails的 model.to_json 后,产生的默认的日期格式
my_string = '2019-06-29T16:35:45.000+08:00'
DateTime.strptime(my_string, "%Y-%m-%dT%H:%M:%S.%L%z")