Questions tagged [string-to-datetime]

217 questions
2
votes
2 answers

Calculate the Last day and Hour of the day from Year_Month_Snap String in SQL Server 2014

I am learning SQL Server and am stuck at this conversion issue. Any help is greatly appreciated. I have a table in SQL Server 2014 with a column Year_Month_Snap which has data in the nvarchar datatype. I need to obtain the last day and hour of the…
2
votes
3 answers

Visual FoxPro String to Date Conversion

how can I convert a string 30-Jul-17 to date format 07/30/17?
Nick
  • 155
  • 4
  • 16
2
votes
2 answers

how to convert string to valid date in javascript

I have time interval e.g. "01:30:00" as the string. Now I want to convert this string to a valid DateTime in javascript to manipulate. for example: add 1 hour.
Morteza QorbanAlizade
  • 1,520
  • 2
  • 19
  • 35
2
votes
4 answers

C# converting different String formats to date

I have a WPF window which contains a textbox in which the user can enter a date in any format that he desires and i have to parse it in a datetime variable, simple enough? I tried various formats, some of them work with datatime.parse some don't,…
Billy
  • 67
  • 1
  • 7
1
vote
3 answers

Objective C: Converting string to nsdate issue

I spent couple of hours to resolve this weird issue. I have date formate in "dd/mm/yyyy hh:mm:ss" and want to know the difference in seconds between my date and NOW. I am doing it like below but not getting why it is getting 31 days wrong? It should…
1
vote
0 answers

Wrong hour given by the expression "object.dt.hour"

The code is returning the wrong hour at 09/04/2023 11:00:00. It is returning me the hour 10 for some reason. I have a date column in a excel sheet with every hour in 2023 (01/01/2023 01:00:00 till today) and I used these lines in my python…
1
vote
1 answer

pd.to_datetime() weird error when parsing correct date format

pd.to_datetime("20/01/2023", format="DD/MM/YYYY") returns an unexpected value error: ValueError: time data '20-01-2023' does not match format 'DD/MM/YYYY' (match) This is how I got to that error: pd.to_datetime("20/01/2023") works, but returns a…
1
vote
1 answer

convert date into index on dataframe for default date

Is it possible to convert a series of dates in a column into a numeric index using pd.to_datetime? After that put it into a variable so I can print the value in a single variable. default_date = '' print(f'value of default_date' :…
Brody_Brody
  • 185
  • 16
1
vote
1 answer

How to change str to date when year data inconsistent?

I've got a dataframe with a column names birthdates, they are all strings, most are saved as %d.%m.%Y, some are saved as %d.%m.%y. How can I make this work? df["birthdates_clean"] = pd.to_datetime(df["birthdates"], format = "%d.%m.%Y") If this…
Sevgisiz
  • 15
  • 3
1
vote
2 answers

Problems in converting ".to_datetime" in Python

I have the following list: l = [
8 December 2004
,
6 December 2004
,
18 October 2004
,
9 October 2004
,
8 August 2004
,
Rollo99
  • 1,601
  • 7
  • 15
1
vote
2 answers

Pandas - to_datetime not parsing utc

I have a csv file with a datetime field called "Reading Time" that looks like the following "2020-09-01 00:06:52 +0000 UTC". When using any of the following to_datetime function in Pandas, I get the following error depending on the function…
Atyeo
  • 21
  • 4
1
vote
2 answers

how to fix string was not recognized as a valid DateTime

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.FormatException: String was not recognized as a valid DateTime. at…
FLK Coding
  • 25
  • 1
  • 1
  • 6
1
vote
1 answer

(Databricks SQL) Date stored as STRING (yyyyMMDD) cannot convert it into DATE (yyyy-MM-DD)

I've spent last 3 hours googling the issue but nothing seems to work in Databricks SQL version specifically. I have to use a database, where someone decided it's best to store date as a STRING, there's no way around it short-term. Current date…
1
vote
1 answer

Apply lambda function to list of columns in pandas dataframe

I have a large dataframe from csv (170 cols). Many of these are date but not being read as date. I have a list of these as date_cols = [col for col in df.columns if 'date' in col] I want to apply a function to all those columns (13 total) How can i…
mapping dom
  • 1,737
  • 4
  • 27
  • 50
1
vote
2 answers

AWS Glue ETL Spark- string to timestamp

I am trying to convert my CSVs to Parquet via AWS Glue ETL Job. At the same time, I am willing to convert my datetime column (string) to timestamp format that Athena can recognize. (Athena recognizes this yyyy-MM-dd HH:mm:ss) I skimmed and applied…
Omur
  • 136
  • 1
  • 7