0

I have a time value, in seconds, for example 4:20pm being 58800. From this value I need to get the Unix timestamp, assuming today's date. How should I approach this?

livin_amuk
  • 1,285
  • 12
  • 26
  • This might help http://stackoverflow.com/questions/19801727/convert-datetime-to-unix-timestamp-and-convert-it-back-in-python – Bahrom May 11 '16 at 14:09

1 Answers1

1
start_of_day = datetime.datetime.combine(datetime.date.today(), datetime.time())
dt = start_of_day + datetime.timedelta(seconds=58800)

Like so?

acdr
  • 4,538
  • 2
  • 19
  • 45