Parse a timestamp string into a datetime object. Args: timestamp: String in the format "Day dd Mon yyyy hh:mm:ss +xxxx" Returns: A datetime object with timezone information
(timestamp: str)
| 36 | |
| 37 | |
| 38 | def parse_timestamp(timestamp: str) -> datetime.datetime: |
| 39 | """ |
| 40 | Parse a timestamp string into a datetime object. |
| 41 | |
| 42 | Args: |
| 43 | timestamp: String in the format "Day dd Mon yyyy hh:mm:ss +xxxx" |
| 44 | |
| 45 | Returns: |
| 46 | A datetime object with timezone information |
| 47 | """ |
| 48 | # Define the format string to match the input timestamp format |
| 49 | format_str = "%a %d %b %Y %H:%M:%S %z" |
| 50 | return datetime.datetime.strptime(timestamp, format_str) |
| 51 | |
| 52 | |
| 53 | def calculate_time_delta(t1: str, t2: str) -> int: |
no outgoing calls
no test coverage detected