Skip to content

Instantly share code, notes, and snippets.

@rhine3
Last active June 26, 2019 15:10
Show Gist options
  • Select an option

  • Save rhine3/de6f8b1014c6a299150f81f18f4befe8 to your computer and use it in GitHub Desktop.

Select an option

Save rhine3/de6f8b1014c6a299150f81f18f4befe8 to your computer and use it in GitHub Desktop.
Convert AudioMoth hexadecimal filenames
from datetime import datetime, timedelta
filename = '5BAC2C6F'
seconds_after_epoch = int(filename, 16)
utc_datetime = datetime.fromtimestamp(seconds_after_epoch)
dst_date = datetime(2019, 3, 10) # FOR UTC CONVERSION - 2019 ONLY
# UTC TO CST CONVERSION
if utc_datetime < dst_date:
actual_datetime = utc_datetime - timedelta(hours=6, minutes=0)
# UTC TO CDT CONVERSION
else:
actual_datetime = utc_datetime - timedelta(hours=5, minutes=0)
print(actual_datetime)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment