How easy is it to initialize a DateTime until today, but with a specific time?
d = DateTime.(??) #desired resulting time => 09 April 2011 9:46 PM
Thanks for your reply @ Vadim. I had to look a little harder. I was able to do this:
DateTime.now.change(:hour => 21, :minute => 46)
DateTime#change must be from some external library. It does not work in the default setting. For cases when you do not have such a library, for example:
DateTime#change
Date.today.to_time+(21*3600+46*60+53)
can work.
Time.new
d = Time.new(2011, 4, 9, 21, 46)
or if you want only the current time
d = Time.new
or
d = Time.now
Source: https://habr.com/ru/post/885589/More articles:How to suspend / resume Java threads - javaLabyrinth optimal left turn algorithm - algorithmHow to create application tests in Cocoa Touch Unit test suite with Xcode 4? - iphoneDatabase design: for EAV or not for EAV? - databaseDo all An ArrayList elements change when a new one is added? - javaOptimization of the gene algorithm - using the -O3 flag - iphoneArray does not load data from plist - objective-cRuby - adding / subtracting elements from one array with another array - arraysHow to determine the environment when you restart the Rails application from the command line? - ruby-on-railsBreakout Game in Java does not pass boolean after calling remove () method - javaAll Articles