Strftime of datetime
-
02-10-2019 - |
Question
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 it 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
Solution
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")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow