Questions tagged [strptime]

`strptime` reads the time from the string s using the timeformat specifiers and converts it into seconds since the year 2000.

779 questions
-1
votes
1 answer

how can I make strptime work on a vector of struct tm in c++?

I'm working in a c++ application that read a csv file and stores the content in a matrix of doubles and in a vector of struct tm. I have something similar to this: #include #include #include using namespace std; int…
-1
votes
1 answer

Print date from multiple elements in an array using Time.strptime

I am trying to print out formatted dates using elements of an array within a hash map (records_array["START_TIME_SEC"]) The first element of the array is: records_hash["START_TIME_SEC"][0] which equals: 1405583947 Printing the hardcoded time works…
12nm
  • 41
  • 5
-1
votes
5 answers

PHP strptime() Doesn't seem to work? I can't see anything wrong

I am currently trying to get a database transfered from an old system to a new one, and i have run into a small issue. I have a db row formatted at: 2007-04-24 00:23:59 (yyyy-mm-dd hh:mm:ss) And i cant seem to get it to work through strptime() Here…
NZ Mikey
  • 126
  • 5
-1
votes
1 answer

strptime validation error django

I have a daterangepicker from which the users set date. The choice of format is "DD MMM YYYY" now to go with that i'm using datetime.datetime.strptime(time, "%d %b %Y"); but still i am getting an error Exception Value:[u"'01 Aug 2013'…
goromlagche
  • 432
  • 1
  • 5
  • 12
-2
votes
2 answers

Extract dates in various formats from string in R

I need to quickly extract dates from character vectors. I have 2 main issues: Various date formats (European and American, alphanumeric and numeric...) Multiple dates in each vector. My vectors are something as follows: c("11/09/2016 Invoice…
Emma Maury
  • 11
  • 4
-2
votes
1 answer

Formatting Dates from Array in Python

I am trying to convert the date format in an array from '2018-03-02' (Y-m-d) to '20180302'. I would think a for loop through the dates array would change each date, however, I am getting the following error: TypeError: strptime() argument 1 must…
KellyNelson
  • 1
  • 1
  • 2
-2
votes
2 answers

'list' object has no attribute 'strptime'

Here I want to read time in 24 hours format include in csv file. I wrote the class to convert time in format %H:%M:%S. but I got an error 'list' object has no attribute 'strptime' Can anyone help to solve this? Here I post my code. import…
user10270654
-2
votes
1 answer

Parse datetime from string in python what can 778 mean?

I need to parse string type value which looks like 017-11-18T05:26:01.778+0000 datetime_object = datetime.strptime(date_in_string, "%Y-%m-%d %H-%M-%S-%j-%f") but it gives mistake like ValueError: time data '2017-11-18T05:26:01.778+0000' does not…
-2
votes
1 answer

Returning strings instead of digits with datetime.strptime

With the following code: current_date = datetime.strptime(row[0], "%Y-%m-%d") dates.append(current_date) I want to return the dates in the string format (i.e. "Jan 2014") but it's returning the dates in the original format as "2014-01-01".
daquezada
  • 1,017
  • 2
  • 10
  • 15
-2
votes
2 answers

Python Datetime strptime ValueError: does not match format

having a little trouble pulling the date from a file of mine. Date strings are in the format: "06/08/2016 # Note the parenthesis and my strptime command is: date = datetime.datetime.strptime(text[0], '\"%m/%d/%Y').date() but I get the following as…
Miles C
  • 147
  • 1
  • 5
-2
votes
1 answer

How can I execute strptime within a string using Ruby?

I have the following code: line_item_interpolated = String.interpolate {line_item} output_line = output_line + line_item_interpolated It works fine for a case where: line_item = #{index}: #{item["value"]["time_string"]} for example. But, if…
Satchel
  • 16,414
  • 23
  • 106
  • 192
-2
votes
1 answer

strptime pattern for something like 2015-11-21T15:30:00

I need to parse a datetime object from a give date as a string. The date looks like this: 2015-11-21T15:30:00 However, the following fails: datetime.strptime("%Y-%m-%d'T'%H:%M:%S", "2015-11-21T15:30:00") with the following error message: Traceback…
toom
  • 12,864
  • 27
  • 89
  • 128
-2
votes
2 answers

Why is there comma in my slice

When I did slice for my date/month/year, there's always this "()" & ",". May I know how do I get rid of it? user input = 21/12/1999 output = (1999,12,21) def get_dateOfBirth(): while True: dateOfBirth_input = raw_input("Please enter…
user5346279
-2
votes
2 answers

Converting date and time from String format to Python datetime object: ValueError: time data '... p.m.' does not match format '... %p'

I have date and time in the below String format: dateTime = '21-03-2015 12:20 p.m.' And I want to convert it into Python datetime object. I'm doing something like below: dateTimeObj = datetime.datetime.strptime(dateTime, '%d-%m-%Y %I:%M %p') But…
Mohd Ali
  • 311
  • 2
  • 13
-2
votes
2 answers

How to convert a string like "28 JUL 1795" to a date with the format of"%B %d, %Y"?

I used following line to transfer my date string but it gave me an error. print datetime.datetime.strptime(arg, '%d %b %Y').date().strftime("%B %d, %Y") ValueError: time data '28 JUL 1795' does not match format '%B %d %Y'
1 2 3
51
52