Last active
March 29, 2018 07:17
-
-
Save maecha/3a873617368e324171e7372be34d02c9 to your computer and use it in GitHub Desktop.
Get the datetime from time. / E.g. From request params
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_datetime_converted_from_time | |
time = Time.zone.now | |
splited_time = params[:object][:time].split(':') | |
local_time = Time.local( | |
time.year, | |
time.month, | |
time.day, | |
splited_time.first.to_i, | |
splited_time.last.to_i,) | |
@datetime = { | |
'time' => local_time,} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment