开发者

Strftime of datetime

I got the below code which I would like to convert to a string in a specific format. But I can't get it working.

Date.today + warning.notify_time_close.seconds

What I want to do is somethin like this but i开发者_如何学Got doesn't work :)

(Date.today + warning.notify_time_close.seconds).strftime "%d-%m-%Y %H:%M:%S"

I know its simple but just don't know how to do it :)

Thanks in advance!

Kenneth


This should not be necessary, but as a workaround you could try this:

Time.at(
    Date.today.to_time.to_i + warning.notify_time_close.seconds
).strftime("%d-%m-%Y %H:%M:%S")
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜