例如:
td = created_at
ta = updated_at
# is there a clean and nice way to print number of days and hours, minutes??
diff = ta - td
最佳答案
查看 distance_of_time_in_words , 它不会总是为您提供准确的日期和时间,但通常它的结果对用户更友好。
关于ruby-on-rails - 如何计算 ruby 中的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5940890/