Skip to content

Instantly share code, notes, and snippets.

@maecha
Last active April 3, 2018 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maecha/82e6c85f26e31e65f70268d2aca20f39 to your computer and use it in GitHub Desktop.
Save maecha/82e6c85f26e31e65f70268d2aca20f39 to your computer and use it in GitHub Desktop.
Creating text-date, Convert Time Class to String Class
class HogesController < ApplicationController
private
def get_date_text
from = params[:from]
to = params[:to]
wave_dash_text = ' ~ '
get_converted_string_date(from) + wave_dash_text + get_converted_string_date(to)
end
def get_converted_string_date(date)
date.strftime('%Y/%m/%d')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment