How to convert Python's .isoformat() string back into datetime object Last Updated : 28 Jul, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will learn how to convert Pythons .isoFormat() string back into a datetime object. Here we are using the current time and for that, we will store the current time in the current_time variable. The function now() of this module, does the job perfectly. Example: Getting current time Python3 from datetime import datetime current_time = datetime.now() print(current_time) Output: 2021-07-22 15:17:19.735037 Get the string format of time In this step, we are going to get the string format of the iso time. For this, isoformat() function is used. Example: getting string format of time Python3 from datetime import datetime current_time = datetime.now().isoformat() print(current_time) Output2021-07-26T11:36:17.090181 Get the DateTime object from the iso format So here we are going to get the DateTime object from the iso string. For that fromisoformat() function is used. Example: Get the DateTime object from the iso format Python3 from datetime import datetime current_time = datetime.now().isoformat() print(datetime.fromisoformat(current_time)) Output: 2021-07-26 17:06:51.149731 Comment More infoAdvertise with us Next Article Convert datetime string to YYYY-MM-DD-HH:MM:SS format in Python M manavsarkar07 Follow Improve Article Tags : Python Python-datetime Python datetime-program Practice Tags : python Similar Reads How to convert DateTime to integer in Python Python provides a module called DateTime to perform all the operations related to date and time. It has a rich set of functions used to perform almost all the operations that deal with time. It needs to be imported first to use the functions and it comes along with python, so no need to install it s 2 min read Convert Array of Datetimes into Array of Strings in Python In this article, we will convert an array of Datetimes into an array of strings. we have an array whose data type is DateTime and we want to change it to string. The shape and size of the array will be the same as the input array but the data type will be different. We will begin with an introductio 4 min read Converting string into DateTime in Python The goal is to convert a date string like "2021/05/25" into a Python-recognized DateTime object such as 2021-05-25 00:00:00. This enables accurate and consistent date operations like comparisons, calculations and formatting when working with time-related data from sources like files or user input. L 2 min read Convert datetime string to YYYY-MM-DD-HH:MM:SS format in Python In this article, we are going to convert the DateTime string into the %Y-%m-%d-%H:%M:%S format. For this task strptime() and strftime() function is used. strptime() is used to convert the DateTime string to DateTime in the format of year-month-day hours minutes and seconds Syntax: datetime.strptime( 2 min read How to Convert String to Date or Datetime in Polars When working with data, particularly in CSV files or databases, it's common to find dates stored as strings. If we're using Polars, a fast and efficient DataFrame library written in Rust (with Python bindings), we'll often need to convert these strings into actual date or datetime objects for easier 5 min read Pandas Convert Date (Datetime) To String Format We are given a column containing datetime values in a pandas DataFrame and our task is to convert these datetime objects into string format. This conversion is useful for visualizing data, exporting it to external applications, or performing string operations. For example, if we have this input:a = 4 min read Like