Skip to content

Instantly share code, notes, and snippets.

@jorgebastida
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save jorgebastida/e5db1b7f6c8d1cab7b8e to your computer and use it in GitHub Desktop.

Select an option

Save jorgebastida/e5db1b7f6c8d1cab7b8e to your computer and use it in GitHub Desktop.

Revisions

  1. jorgebastida revised this gist Dec 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion radom_date.py
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,4 @@
    from datetime import datetime

    def random_date(start, end):
    return datetime.fromtimestamp(random.randint(*map(int, (start.strftime('%s'), end.strftime('%s')))))
    return datetime.fromtimestamp(random.randint(*map(lambda x: int(x.strftime('%s')), (start, end))))
  2. jorgebastida revised this gist Dec 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion radom_date.py
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    import random
    from datetime import datetime, timedelta
    from datetime import datetime

    def random_date(start, end):
    return datetime.fromtimestamp(random.randint(*map(int, (start.strftime('%s'), end.strftime('%s')))))
  3. jorgebastida created this gist Dec 5, 2014.
    5 changes: 5 additions & 0 deletions radom_date.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    import random
    from datetime import datetime, timedelta

    def random_date(start, end):
    return datetime.fromtimestamp(random.randint(*map(int, (start.strftime('%s'), end.strftime('%s')))))