No need to import time; datetime.datetime.strptime can do it by itself.

import datetime
dt=datetime.datetime.strptime(data[4]+data[5],'%Y%m%d%H%M%S')
print(dt)
# 2010-03-04 08:28:35

For information on the format codes (e.g. %Y%m%d%H%M%S) available, see the docs for strftime.

Answer from unutbu on Stack Overflow
🌐
pytz
pythonhosted.org › Moments › api › timestamp.html
The timestamp Module — Moments 2.0 documentation
return a new Timestamp object that is in the past according to parameters ... return a string representation of our internal datetime object with a format like: YYYYMMDDHHMMSS controlled by ‘accuracy’
Discussions

apex - Trying to convert Datetime to a certain format yyyymmddHHmmss - Salesforce Stack Exchange
If System.now() returns 2021-09-06 19:50:23 and the output string that I want to send is 20210906195023 for some reason I tried capturing this datetime as a string but to force a format messes up the More on salesforce.stackexchange.com
🌐 salesforce.stackexchange.com
September 7, 2021
Convert string "YYYYMMDDHHMMSS" to timestamp in Python - Stack Overflow
I need help to convert this string '20190625091115' to timestamp '25-06-2019 09:11:15' in python. Format in 'YYYYMMDDHHMMSS > Format out 'DD-MM-YYYY HH:MM:SS'. More on stackoverflow.com
🌐 stackoverflow.com
August 20, 2019
Getting today's date in YYYY-MM-DD in Python? - Stack Overflow
To get just the date from the timestamp, call Timestamp.date. More on stackoverflow.com
🌐 stackoverflow.com
python-3.5, timestamp to YYYYmmDDHHMMSS - Stack Overflow
Hello to every saturday workers! I need to convert a timestamp to YYYYmmDDHHMMSS. The following works well timestamp=now_var[27:38] # timestamp string dth_now=( ... More on stackoverflow.com
🌐 stackoverflow.com
January 16, 2016
🌐
GeeksforGeeks
geeksforgeeks.org › convert-datetime-string-to-yyyy-mm-dd-hhmmss-format-in-python
Convert datetime string to YYYY-MM-DD-HH:MM:SS format in Python - GeeksforGeeks
December 19, 2022 - First the take DateTime timestamp as a String. Then, convert it into DateTime using strptime(). Now, convert into the necessary format of DateTime using strftime · Example 1: Python program to convert DateTime string into %Y-%m-%d-%H:%M:%S format
🌐
Python documentation
docs.python.org › 3 › library › datetime.html
datetime — Basic date and time types
Because naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing a specific timestamp in UTC is by calling datetime.fromtimestamp(timestamp, tz=timezone.utc).
🌐
Restack
restack.io › p › datetime-manipulation-techniques-knowledge-answer-yyyymmddhhmmss-python
Datetime Format Yyyymmddhhmmss Python | Restackio
May 6, 2025 - When dealing with datetime formats in Python, the 'yyyymmddhhmmss' format is a compact representation that combines the year, month, day, hour, minute, and second into a single string.
🌐
Programiz
programiz.com › python-programming › datetime › strftime
Python strftime() - datetime to string
from datetime import datetime timestamp = 1528797322 date_time = datetime.fromtimestamp(timestamp) d = date_time.strftime("%c") print("Output 1:", d) d = date_time.strftime("%x") print("Output 2:", d) d = date_time.strftime("%X") print("Output 3:", d) ... Format codes %c, %x and %X are used for locale's appropriate date and time representation. We also recommend you to check Python strptime().
Find elsewhere
🌐
Esri Community
community.esri.com › t5 › python-questions › convert-date-to-yyyymmdd-string-in-field › td-p › 616266
Convert Date to yyyymmdd string in field calculator with Python
March 14, 2022 - Hello, I am stuck with syntax for what I think will be very easy task. I have a feature class with a date field that I simply want to convert to a string field in yyyymmdd format, so that I can combine it with other fields to create a unique ID. Id like to do this in a simple field calculator (in ...
🌐
YouTube
youtube.com › vlogize
Converting Python Datetime to String in the Format YYYYMMDDHHMMSS - YouTube
Learn how to convert Python datetime objects to strings in the specific format YYYYMMDDHHMMSS. Explore the steps and code examples for easy implementation.--...
Published   March 2, 2024
Views   26
🌐
Java2Blog
java2blog.com › home › python › python date › format date to yyyymmdd in python
Format Date to YYYYMMDD in Python - Java2Blog
November 27, 2023 - pandas_date.strftime("%Y%m%d") uses the strftime() method, similar to Python’s standard datetime, to format the Timestamp object to YYYYMMDD.
🌐
PYnative
pynative.com › home › python › python datetime › python datetime format using strftime()
Python DateTime Format using Strftime() – PYnative
May 6, 2022 - from datetime import datetime # # pip install pytz import pytz # get timestamp ts = datetime.now().timestamp() # assigning the timezone to the current timestamp dt = datetime.fromtimestamp(ts, pytz.timezone('America/New_York')) # displaying the datetime string in ISO format print('ISO Date Format:', dt.strftime('%Y-%m-%d %H:%M:%S%z (%Z)')) Code language: Python (python) Run
🌐
Python
docs.python.org › 3.4 › library › datetime.html
8.1. datetime — Basic date and time types — Python 3.4.10 documentation
Return the local date and time corresponding to the POSIX timestamp, such as is returned by time.time().
🌐
Stack Overflow
stackoverflow.com › questions › 34826243 › python-3-5-timestamp-to-yyyymmddhhmmss
python-3.5, timestamp to YYYYmmDDHHMMSS - Stack Overflow
January 16, 2016 - I need to convert a timestamp to YYYYmmDDHHMMSS. The following works well · timestamp=now_var[27:38] # timestamp string dth_now=( # string date heure datetime.datetime.fromtimestamp( int(timestamp) ).strftime('%Y%m%d_%H%M%S') ) # a string ... File "C:\_Python\kWh_compare.py", line 35, in <module> ).strftime('%Y%m%d_%H%M%S') ValueError: invalid literal for int() with base 10: ''
🌐
Course Hero
coursehero.com › griffith university › eng › eng-1007 › convert timestamp into an yyyymmddhhmmss format convert speed from miles/hour to kilometers/hour. [33] : pandas ....
[Solved] Convert timestamp into an YYYYMMDDHHMMSS format Convert speed from miles/hour to kilometers/hour. [33] : pandas .... | Course Hero
May 9, 2024 - Convert timestamp into an YYYYMMDDHHMMSS format Convert speed from miles/hour to kilometers/hour · ENGINEERING & TECHNOLOGY · COMPUTER SCIENCE · PYTHON PROGRAMMING · ENG 1007 · Solved by verified expert · Rated · Helpful · Answered by rajan133 · sectetur adipiscing elit.
🌐
Flexiple
flexiple.com › python › python-timestamp
Python Timestamp - Get Current timestamp in Python - Flexiple
In this example, the fromtimestamp() function converts the given timestamp to a datetime object, representing the date and time associated with that timestamp. Additionally, Python offers flexibility in formatting datetime objects into human-readable strings using the strftime() method.
🌐
iO Flood
ioflood.com › blog › python-datetime-to-string
Learn Python: Convert datetime to string (With Examples)
February 7, 2024 - Performing Date and Time Arithmetic – Explore datetime arithmetic and timedelta objects in Python. Working with Timestamps in Python – Understand how to use timestamps in the datetime module of Python.
🌐
Dataquest
dataquest.io › blog › python-datetime
Python Datetime: A Simple Guide with 39 Code Examples (2023)
January 5, 2026 - new_year_2023 = datetime(2022, 12, 31) datetime.timestamp(new_year_2023) ... Sometimes, we may want to compute the difference between two dates or perform other arithmetic operations on dates and times. Fortunately, Python has many instruments in its toolkit to perform such calculations.