Reputation: 1365
I know it is very very simple but am not getting how to do it.
end_time = Time.new(Date.today.year, Date.today.month, Date.today.day, 8, 00, 00).strftime("%H:%M:%S")
But in above code i want tomorrow instead of today i.e. '+1 day'. How can i do it?
I tried:
end_time = Time.new(Date.today.year, Date.today.month, Date.today.day, 8, 00, 00).strftime("%H:%M:%S") + 1.day
or
end_time = Time.new(Date.tomorrow.year, Date.tomorrow.month, Date.tomorrow.day, 8, 00, 00).strftime("%H:%M:%S")
But no use. Can anybody answer it?
Upvotes: 1
Views: 1973
Reputation: 407
Simply you can use :-
end_date = Date.tomorrow
= date_field_tag :date_of_journey, end_date
Upvotes: 0
Reputation: 1445
In rails you can use : end_time + 1.day
or 1.day.from_now
Added specific case:
if @order.delievery_time.between?(start_time, end_time + 1.day)
@time = @order.delievery_time.strftime("%H:%M:%S")
end
Upvotes: 6