Skip to content

Instantly share code, notes, and snippets.

@satriahrh
Created October 3, 2019 06:47
Show Gist options
  • Save satriahrh/6dfb6e0a34246ab6be78e1775e8fb677 to your computer and use it in GitHub Desktop.
Save satriahrh/6dfb6e0a34246ab6be78e1775e8fb677 to your computer and use it in GitHub Desktop.

Ruby Cheat Sheet

How to generate a random date and time between two dates?

Time.at((date2.to_f - date1.to_f)*rand + date1.to_f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment