Last active
June 18, 2021 21:57
-
-
Save ronan-cunningham/3a4f76817e5e560bc2e02fd58905ecc1 to your computer and use it in GitHub Desktop.
Create a DynamoDb time to live value using a number of days as an input
This file contains 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
import time | |
def get_ttl(days: int) -> int: | |
seconds_since_epoch=int(str(time.time()).split('.')[0]) | |
seconds_in_n_days=days * 86400 | |
time_to_live=seconds_since_epoch + seconds_in_n_days | |
return time_to_live |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment