`strptime` reads the time from the string s using the timeformat specifiers and converts it into seconds since the year 2000.
Questions tagged [strptime]
779 questions
-3
votes
1 answer
have issue converting '09-JUN-14 12.00.00.000000000 AM' to datetime in python
I have been trying to convert '09-JUN-14 12.00.00.000000000 AM' to '2014-06-09 23:11:00'
I have tried two methods:
dk = datetime.strptime( '09-JUN-14 12.00.00.000000000 AM', '%D-%M-%Y %H.%M.%S.F')
dk = pd.to_datetime('09-JUN-14 12.00.00.000000000…

jay
- 3
- 3
-3
votes
3 answers
datetime.strptime is not support to convert future date?
I had the following error in Nov 13th 2022
end = datetime.strptime("2022-11-16", "%Y-%d-%m")
Traceback (most recent call last):
File "", line 1, in
File…

Jun Takeshita
- 7
- 7
-3
votes
1 answer
How can I add n number of datetime.strptime in "%I:%M:%S" format stored in a list in python
I've n number of datetime.strptime items stored in a list in "%I:%M:%S" format
total_logs = ['0:00:12', '0:10:02', , , n]
How can I add them?

Milind Khobragade
- 47
- 8
-3
votes
1 answer
Can't turn datetime string into datetime object - ValueError
date_time_str = data['date']
date_time_obj = dt.datetime.strptime(date_time_str, "%Y-%m-%d %H:%M:%S")
print(date_time_obj)
I get this error:
ValueError: time data 'date' does not match format '%Y-%m-%d %H:%M:%S
But the string datetime is the same…

Ovicron
- 91
- 1
- 4
- 9
-3
votes
1 answer
Golang time.Parse() Formatting with Non-Time Number
I am porting code from python and have a function that takes a formatting string and equivalent datetime string and creates a datetime object:
import datetime
def retrieve_object(file_name, fmt_string):
datetime = datetime.strptime(file_name,…

WXMan
- 310
- 1
- 12
-3
votes
1 answer
Datetime - Strftime and Strptime
Date = datetime.datetime.today().strftime("%d %B %Y")
x = datetime.datetime.strptime(Date , "%d %B %Y")
returns:
2018-05-09 00:00:00
instead of:
9 May 2018, what am I doing wrong?
Essentially I am trying to get the non zero padded version of…

bloo
- 306
- 4
- 13
-3
votes
1 answer
How to convert a datetime text into datetime object in Python?
I want to convert a datetime string to datetime object which will be further processed to display in a different format.
The string is in the for, 2018-04-24T16:42:17Z.
I have tried the following method but it gives error.
import…

Boudhayan Dev
- 970
- 4
- 14
- 42
-3
votes
3 answers
How can I convert a str type to date type using python
I'm trying to convert a str type ( like :"1995-01-09 00:00:00") to date, here is my attempt
for line in ratings_df[['user_id','movie_id','rating','timestamp']].values:
annee= line[3]
print datetime.strptime(annee, "%Y-%m-%d %H:%M:%S")
and I…

Hamza Lahbabi
- 29
- 1
- 9
-3
votes
1 answer
Python ValueError: time data '' does not match format '%m/%d/%Y'
I have the following error:
line 73, in formatFile
outRow.append(datetime.datetime.strptime(row[5],'%m/%d/%Y').strftime('%Y-%m-%d'))
ValueError: time data '' does not match format '%m/%d/%Y'
Script below:
import datetime
def…

Ali P
- 65
- 8
-3
votes
2 answers
ValueError: time data '1/1/17 0:03' does not match format '%m/%d/%Y %H:%M'
I want to convert the time in csv file to a datetime object in Python so that I can calculate the time difference. But I am keeping get error when I do that.
My codes were:
import datetime
from time import strptime
a=datetime.strptime('1/1/17…

Ethan Huang
- 3
- 1
- 3
-3
votes
1 answer
strptime returning NA values
I'm trying to use strptime to format dates I'm reading in but only get NA values are returned in the output.
My raw data is in the format of 1974-01-01, and the length of the dataset is 12049 so the last date is 2006-12-31.
The code I use…

Colin
- 9
- 1
-3
votes
1 answer
Conversion of '2013-05-22 02:00pm' to '2013-05-22 14:00' in R
I want to convert the following format into a standard date format in R:
2013-05-22 02:00pm
to
2013-05-22 14:00
I've tried using strptime, but it outputs 2013-05-22 02:00 MST, which would mean 2AM. How do I fix this?

Moon_Watcher
- 416
- 1
- 6
- 19
-4
votes
1 answer
Converting date string to Datetime
I have a function which returns in YYYY-MM-DD i want to add 10 days to this date and check if today is the date. how can i do that.
def date_return:
return YYYY-MM-DD

jimmy
- 45
- 9
-7
votes
2 answers
How to convert 12 hour string into 24 hour datetime?
I've seen solutions for converting something like '7:30 PM' using the datetime.strptime format '%I:%M%p' (e.g. here), but I have strings that look like this:
'05:15:00.000000000 AM'
The fact that there are both seconds and AM/PM seems to be…

user3591836
- 953
- 2
- 16
- 29