Question
I am wondering what the best way to loop over a string to get the dates and times of that string and return a list
I am wondering what the best way to loop over a string to get the dates and times of that string and return a list of them? For example if I have a string of 'February 27, 2021 11:00 AM PST March 01, 2021 11:00 AM PST March 02, 2021 11:00 AM PST' I would like to return a list of [2021-02-27T11:00:00, 2021-03-01T11:00:00, 2021-03-02T11:00:00] the issue here is these are not fixed times meaning they could change so I am trying to do something that will go over the string of any dates and times assuming I wouldn't already know what the dates and times were this also needs to be done in python!!!. hopefully this makes sense!
Examples of changed dates and time could be 'March 3, 2021 12:00 PM PST March 15, 2021 1:00 PM PST March 23, 4:30 PM PST or 'May 10, 2021 10:00 AM PST August 03, 2021' -- the dates and time will change because this will be user input from a form so it could be one date and time or more, in the original example I have 3 dates and times. The goal is to extract that information and return a list on those dates and time in the format from the original example
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started