Ruby Date 1 month ago to String -


i need calculate date 1 month today in ruby , convert string in format:

yyyy-dd-mmthh:mm:ss (e.g. 2014-08-26t00:00:00)

i have tried: (datetime.now - date.today.prev_month).to_datetime.strftime("%ft%t") method not exist exception.

try this:

require 'date'  d = date.today.prev_month # or date.today.next_month, depending want  => #<date: 2014-12-27 ((2457019j,0s,0n),+0s,2299161j)>  d.strftime("%ft%t")  => "2014-12-27t00:00:00"  

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -