Skip to content

Instantly share code, notes, and snippets.

@marcomontes
Last active August 29, 2015 14:22
Show Gist options
  • Save marcomontes/c9d1fae0d45896932d8b to your computer and use it in GitHub Desktop.
Save marcomontes/c9d1fae0d45896932d8b to your computer and use it in GitHub Desktop.
Función que retorna la fecha en el uso horario especificado
###  Ex: change_offset('-5', Article.last.created_at)
def change_offset(user_offset, publish_date)
offset = Rational(user_offset, 24)
user_publish_date = publish_date.to_datetime.new_offset(offset)
user_publish_date.strftime("%B %dth. %Y, %I:%M%P")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment