Questions tagged [string-to-datetime]

217 questions
1
vote
2 answers

Trying to compare extensionAttribute (string) to DateTime in PowerShell

I'm currently writing a PowerShell script that automatically Enable/Disable new hires in my company. The situation today is that when HR recruit new employee he added automatically to AD with his starting date in extension attribute in this format -…
1
vote
1 answer

Using to_datetime several columns names

I am working with several CSV's that first N columns are information and then the next Ms (M is big) columns are information regarding a date. This is the dataframe picture I need to set just the columns between N+1 to N+M - 1 columns name to date…
nabetse.cl
  • 11
  • 1
1
vote
1 answer

Convert date format to 'Month-Day-Year'

I have a column full of dates of 2 million rows. The data format is 'Year-Month-Day', ex: '2019-11-28'. Each time I load the document I have to change the format of the column (which takes a long time) doing: pd.to_datetime(df['old_date']) I would…
alelew
  • 173
  • 3
  • 13
1
vote
1 answer

Converting dates less than 1970 in python using pandas

I want to convert dates of which are less than 1970 to pd.to_datetime format but am unable to do so as any date less than 1970 gets converted to the new millennium (>2000). I want the dates to be converted as follows: 15/01/1967 to…
1
vote
1 answer

pd.to_datetime format argument is rejected

I can not understand this exception: date = '01/01 24:00:00' pd.to_datetime(date, format = '%m/%d %H:%M:%S') --------------------------------------------------------------------------- TypeError Traceback (most…
user8270077
  • 4,621
  • 17
  • 75
  • 140
1
vote
1 answer

Pandas to_datetime parsing for oddly formatted date

TL;DR: How can I use format parameter in pd.to_datetime() to parse a date that is formatted as 'YYYY mmdd dd'? Background: I am pulling some data from an api and the index is a date but is formatted as a string. Here's what the index looks…
1
vote
1 answer

How can I convert a string like 3hours26minutes33seconds into HH:MM:SS format in python?

I have a string '3hours26minutes33seconds' and I need to convert this into HH:MM:SS format. I tried using dateutil.parser.parse to no avail.
1
vote
4 answers

String to time in php

I am making a web application that connects to user's Dropbox account. When i retrieve metadata of files and folders, Dropbox returns corresponding modified dates on following format: "Sat, 21 Aug 2010 22:31:20 +0000" How can i convert this to…
Prashant
  • 7,340
  • 2
  • 25
  • 24
1
vote
3 answers

Comparing date column of the csv file to today date

I need to compare my large data's date with today date to calculate another column value if the date is more than or less than today. My code is as below however I'm keep getting error! I have tried Timestamp.now() but my python 3.6 can not…
Z.A
  • 55
  • 4
1
vote
1 answer

to_datetime() in pandas returns a Categorical type rather than a datetime object

Here is a sample of the code: data.timestamp = pd.to_datetime(data.timestamp, infer_datetime_format = True, utc = True) data.timestamp.dtype CategoricalDtype(categories=['2016-01-10 06:00:00+00:00', '2016-01-10 07:00:00+00:00', …
user8270077
  • 4,621
  • 17
  • 75
  • 140
1
vote
1 answer

Efficient Dataframe column (Object) to DateTime conversion

I'm attempting to create a new column that contains the data of the Date input column as a datetime. I'd also happily accept changing the datatype of the Date column, but I'm just as unsure how to to that. I'm currently using DateTime =…
anakaine
  • 1,188
  • 2
  • 14
  • 30
1
vote
4 answers

How can I convert this "2012-08-16T19:20:30.456+08:00" string to DateTime using C#

I want to convert string datetime to Datetime using C#. I am going to store datetime in sql database
1
vote
1 answer

Having troubles converting pandas datetime to unix time stamp

What I need to do is convert 'year-month-day' timestamp to Unix time stamp do somethings with it then change it back to date time series. I am working with '1999-09-07' as my timestamp. I am getting an error : invalid literal for int() with base 10:…
1
vote
2 answers

Datetime string with whitespace, local date

I am trying to convert a datetime string (German) that comes from MS Project Excel Export. 02 Februar 2022 17:00 I read it from a Excel-Export of MS Project in to a pandas dataframe. When converting it with to_datetime(df["Anfang"], format= '%d %B…
nanuuq
  • 169
  • 9
1
vote
1 answer

How to convert string to date in format yyyy-MM-dd HH:mm:ss?

I have string with format : '20018-03-03 11:00:00', and i want to convert to Date but keeping this format. Is this possible? Because when I do something like this : Date.parse(string), I don't get this format, event when I use SimpleDateFormat.…
None
  • 8,817
  • 26
  • 96
  • 171