0

Need help in extrating the Date and Time from the below format, to get the Mins left with current time

Tuesday, May 18, 2021 | 9:00 AM Central
Tuesday, May 18, 2021 | 9:00 AM Eastern
Tuesday, May 18, 2021 | 7:00 AM Pacific

I have used the below code to get date and time:

date_time_string = "Tuesday, May 18, 2021  |  9:00 AM Central"
len_tag_split = int(date_time_string.find('|'))  // getting the length
time_string = date_time_string[len_tag_split + 1:].strip()  // Time Informtion 
day_string = date_time_string[:len_tag_split - 1].strip()   // Date Information
date_info = datetime.strptime(day_string, '%A, %B %d, %Y')

timeZone_tag = time_string.find('Central')
time_zone = time_string[:timeZone_tag -1].strip()   
    print(scrapped_date)
    print(time_zone)

output:

2021-05-18 19:25:29.850926
9:00 AM

I am not able to extract or / get the number of mins from the above

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

0 Answers0