I have the following problem: I want to get yesterday’s timestamp at a specific time.
With what I have found so far:
Time.local(Time.now.strftime("%Y"), Time.now.strftime("%m"), (Time.now.strftime("%d")-1), 23, 59, 59).tv_sec
I am new to Ruby, so probably the reason my Ruby code looks just like PHP :)
Maybe this will help when I say that I would like something like this PHP solution in Ruby:
mktime(23,59,59,date("m",time()),date("d",time()-86400),date("Y",time()));
source share