# import datetime module from datetime
from datetime import datetime
# consider the time stamps from a list in string
# format DD/MM/YY H:M:S.micros
time_data = ["25/05/99 02:35:8.023", "26/05/99 12:45:0.003",
"27/05/99 07:35:5.523", "28/05/99 05:15:55.523"]
# format the string in the given format : day/month/year
# hours/minutes/seconds-micro seconds
format_data = "%d/%m/%y %H:%M:%S.%f"
# Using strptime with datetime we will format string
# into datetime
for i in time_data:
print(datetime.strptime(i, format_data))
import datetime
datetime.datetime.now().strftime ("%Y%m%d")
20151015
Yes, the strftime() method returns a string representing date and time using
date,
time or
datetime object.
Code Example |
---|
:: get key of min value |
:: online python debugger |
Python :: funcion que reciba una cadena en python |
:: |
Python :: sorting-a-python-list-by-two-fields |
Python :: |
Python :: regex emaple py |
:: |
:: |
Python :: pygame.k_kp_enter |
:: |
Python :: programe to find contagious sum of sequence |
Python :: float python precision |
Python :: |
:: |
:: |
:: |
:: |
:: |
Python :: |
Python :: ipython list command history |
Python :: |
Python :: |
:: filter numbers with bounds filter_bounds python |
Python :: |
Python :: dataset analysis in python photo photoelectric effect |
:: |
:: |
:: |
:: |