Last active
September 26, 2021 03:13
-
-
Save wrburgess/1944532 to your computer and use it in GitHub Desktop.
Ruby and Date/Time random date in range
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date_of_last_entry = Date.parse(Time.at(last_entry).strftime('%Y/%m/%d')) #2011-02-29 | |
Date.today - date_of_last_entry == 0 | |
# get random DateTime in last 3 weeks | |
DateTime.now - (rand * 21) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment