Skip to content

Instantly share code, notes, and snippets.

@dominiksimgen
Created March 17, 2021 10:05
Show Gist options
  • Save dominiksimgen/6ba7a143ea9a04bcb14d34ecaf95f9cc to your computer and use it in GitHub Desktop.
Save dominiksimgen/6ba7a143ea9a04bcb14d34ecaf95f9cc to your computer and use it in GitHub Desktop.
parse datetime from string
import openpyxl, os, datetime
here = os.path.dirname(os.path.abspath(__file__))
os.chdir(here)
wb = openpyxl.load_workbook("mb51.xlsx")
sheet1 = wb[wb.sheetnames[0]]
date_time_str = sheet1.cell(4,3).value
date_time_obj = datetime.datetime.strptime(date_time_str, '%d.%m.%Y')
print(date_time_obj.isocalendar()[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment