Questions tagged [string-to-datetime]

217 questions
0
votes
1 answer

Compare Dates in Column Headers

Currently my column headers are in the format x.strftime('%b %Y') (Eg. June 2022, Jul 2022, Aug 2022 and so on....) I want to apply the following code selecting a particular range of cols with the below code: Df = Df.loc[:, (Df.columns >=…
Saanchi
  • 69
  • 6
0
votes
0 answers

How to convert string to date BigQuery 2023-02-13 00:00:00.000000000

Help me please! I have date to string fotmat in 2023-02-13 00:00:00.00000000 Any conversion ends with an error. tried a lot of ways. Has anyone experienced something similar? I try this PARSE_DATETIME('%m/%d/%Y',date) PARSE_DATE('%m/%d/%Y',date)…
Oly
  • 11
  • 4
0
votes
1 answer

ValueError: time data '\r' does not match format '%Y%m%d:%H%M' (match)

I am trying to read data from an online database and convert the first row to a timestamp. Although using the right format string in to_datetime, but I got the error time data '\r' does not match format '%Y%m%d:%H%M' (match) Here is the code: import…
Homer
  • 97
  • 1
  • 8
0
votes
4 answers

Convert a string to a date format using a script or a Google Sheets built-in formula

DESCRIPTION: I want to convert a DD/MM/YYYY HH:mm or 25/01/2022 11:00 string, in an accepted date format. Doesn't matter which one, it just has to be recognized by Apps Script and Google Sheets and be able to work with it. If you can provide an…
0
votes
1 answer

Pandas DateTime String/List

I need to convert a list of strings to date time objects, particularly with Pandas. I really hope this doesn't get flagged as a duplicate because I have seen similar questions, but none have answered my question I have tried this and I was expecting…
0
votes
1 answer

How can I convert a specific string format to date or datetime in Spark?

I have this string pattern in my Spark dataframe: '8 de jan de 2014 08:57:15'. It's a PT-BR pattern. I want to convert this to datetime format, using Databricks and Spark. I've already tried this: df.select(f.to_timestamp(f.col('date_column'), 'd…
0
votes
0 answers

pd.to_datetime format '%Y-%m-%d' does not apply

when using python and pandas I want to convert time full datetime [ns] format to YYYY-mm-dd format. When applying the format according to instructions, it does not apply at all. pd.to_datetime(df.datum,…
karwi
  • 23
  • 3
0
votes
2 answers

Python Pandas to_datetime Without Zero Padded

I am trying to convert a date & time string using Pandas 'to_datetime', but the string values is non-zero padded: 3/31/22 23:30 3/31/22 23:45 4/1/22 0:00 4/1/22 0:15 I have the following but get a mismatch error pd.to_datetime(df.TimeStamp,…
2S2E
  • 21
  • 5
0
votes
1 answer

How to convert 'Jul 24 2022' to '2022-07-24' in spark sql

I want to convert a string date column to a date or timestamp (YYYY-MM-DD). How can i do it in scala Spark Sql ? Input: D1 Apr 24 2022| Jul 08 2021| Jan 16 2022| Expected : D2 2022-04-24| 2021-07-08| 2022-01-16|
0
votes
2 answers

Getting error while trying TO_DATE function for procedure conversion

There is a cast function that is being used in a Teradata procedure as cast( AS DATE FORMAT 'MM/DD/YY' It is giving me output as DATE datatype of format 'MM/DD/YY'. I am trying to use similar function in SNOWFLAKE so that it would give me…
0
votes
1 answer

convert pandas column to to_datetime

I am trying to convert 'Thursday - 6/13/2019' to pd.to_datetime in a pandas dataframe column called 'timestamp". Here is my attempt to solve the problem: df['timestamp'] = pd.to_datetime(df['timestamp'], format='%A - %x') Thanks.
0
votes
2 answers

Time Series Data Reformat

I am working on some code that will rearrange a time series. Currently I have a standard time series. I have a three columns with with the header being [Date, Time, Value]. I want to reformat the dataframe to index with the date and use a header…
Moose Drool
  • 115
  • 2
  • 11
0
votes
2 answers

Pandas dataframe to_datetime() gives error

Goal: I read measurement data from a .csv and convert them to a dataframe. Then I add the date information from the filename to the time string which is already in the dataframe. And the last step is to convert this string with date and time…
nistras
  • 1
  • 2
0
votes
0 answers

Compare present date to previous/next date

Suppose i have a string like , let oldDate = "30-1-2022"; let presentDate = new Date(Date.now()).toLocaleDateString("en-GB"); console.log(oldDate,presentDate) Now my question is how can i check wich Date is the biggest Date.
0
votes
2 answers

ValueError: '%' is a bad directive in format '%d%^b%y'

I am trying to convert string to datetime. The string syntax is 30JUN21. Code: df.column = pd.to_datetime(df.column, , format='%d%^b%y') Error: ValueError: '%' is a bad directive in format '%d%^b%y' I am pretty sure this error relates to the…