开发者

ROR + Increase Time Stamp By One Hour

开发者 https://www.devze.com 2023-02-14 20:26 出处:网络
H开发者_StackOverflow中文版ere, My timestamps code for Ruby is #{Time.now.utc.strftime(\"%B #{ActiveSupport::Inflector.ordinalize(Time.now.day)}%Y%R\")}\".

H开发者_StackOverflow中文版ere, My timestamps code for Ruby is

#{Time.now.utc.strftime("%B #{ActiveSupport::Inflector.ordinalize(Time.now.day)}%Y%R")}".

Now I want to increase my hour by one. So how it can be possible ?


If I understand correctly you can add one hour and then format them to your previous format:

(Time.now+1.hour).utc.strftime("%B #{ActiveSupport::Inflector.ordinalize(Time.now.day)}%Y%R")
0

精彩评论

暂无评论...
验证码 换一张
取 消