def generate_dates(submission_date_s3, ts_offset=0, creation_offset=0):
# convert submission_date into profile_creation_date and timestamps
submission = arrow.get(submission_date_s3, "YYYYMMDD")
creation = submission.replace(days=+creation_offset)
timestamp = submission.replace(days=+ts_offset)
# variables for conversion
epoch = arrow.get(0)
seconds_per_day = topline.seconds_per_day
nanoseconds_per_second = 10**9
date_snippet = {
"submission_date_s3": submission_date_s3,
"profile_creation_date": (
long((creation - epoch).total_seconds() / seconds_per_day)
),
"timestamp": (
long((timestamp - epoch).total_seconds() * nanoseconds_per_second)
)
}
return date_snippet
评论列表
文章目录