Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to initialize a DateTime to today, but with a specific time?

How to easily initialize a DateTime to today, but with a specific time?

d = DateTime.(??)
#desired resulting time => 09 April 2011 9:46 PM
like image 467
Zabba Avatar asked Apr 10 '11 00:04

Zabba


1 Answers

Thanks for your answer @Vadim. I should have searched a bit harder.. I was able to do this:

DateTime.now.change(:hour => 21, :minute => 46)
like image 137
Zabba Avatar answered Sep 30 '22 01:09

Zabba