Questions tagged [str-to-date]

139 questions
0
votes
1 answer

ValueError: time data 'X' does not match format '%m/%d/%y %H:%M' (match)

and I encountered a problem when I was using pandas.to_datetime to convert a column to datetime, could you help me to figure out why? Thank you. I tried to change the format but I don't know what is wrong.
0
votes
1 answer

How do I parse a MySQL date string where the month doesn't have a leading zero?

How do I convert strings like '1021970' (January 2, 1970) or '12021970' (December 2, 1970) with varying month lengths into MySQL dates?
Tyler
  • 161
  • 1
  • 11
0
votes
1 answer

STR_TO_DATE equivalent in snowflake

Trying to replicate the below Mysql expression in snowflake but facing issues with the same , The same works perfectly for me in mysql. SELECT STR_TO_DATE(CONCAT('201439',' Sunday'), '%X%V %W'); Please see below the sample query and the output the…
0
votes
1 answer

How to load CSV data into MYSQL to get a TIME datatype in 24 HR format

I am trying to load data from a csv file into MYSQL. One of the columns in the csv table contains data related to time. The data is stored in the column titled Issue_Time with time values such as as 07:30A and 01:35P, where A and P represent AM and…
0
votes
0 answers

How does BETWEEN keyword works into the WHERE statement

I'm trying to select all rows from a table that are included into a given time range, Suppose I have the following table: `range` ( `id`, `from`, `to` ) Where from and to have the type: VARCHAR( 19 ) (for YYYY-MM-DD HH:II:SS). As these attributes…
Lucas F
  • 15
  • 6
0
votes
0 answers

How to convert str to timestamp in dataframe?

I was unable to use the .weekday() method because data['Date'] is formatted as a string. However, when I tried to use a look to change data type to date it produced an error, saying it was a foat? dates = [] for date in data['Date']: dtobj =…
0
votes
1 answer

How to write query for date exact match in mysql

I would like to know how to query to display the list if date of user matches with the date dob in the table user always have the dateformat as 02 Oct 1992 dd mm yyyy How to convert the user date format(yyyy mm dd) and check the dobmatches in mysql…
sen
  • 91
  • 7
0
votes
0 answers

Error Code: 1193. Unknown system variable 'lastmodified' 0.000 sec from converted datetime in mysql workbench

I have a hard time loading the data below with datetime into mysql workbench. The system always flag out "Error Code: 1193. Unknown system variable 'lastmodified' 0.000 sec". It would great if anyone can help me out. Thanks! Here is my data: id …
0
votes
2 answers

str_to_date returning incorrect year value

I'm trying to convert a date with m/d/y format to yyyy-mm-dd. select lastname, firstname, filingdate, str_to_date(filingdate, '%m/%d/%y') as reformattedDate from Table; For the returned dates, the month and day are correct, but the year is always…
0
votes
2 answers

How do I load data from XML where date is in %W %e, %Y format?

I can load the XML file but the data columns show as NULL. I want the column to be a date column but I can't figure out how to format the two date columns. If I add: SET date1= STR_TO_DATE(@ddate1,'%M %e, %Y'), SET date2= STR_TO_DATE(@date2,'%M…
0
votes
0 answers

Unable to read datetime data with STR_TO_DATE() in MySQL LOAD operation

My Table looks like this !mysql praxisDB -e 'desc eCommerce' +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ |…
Calcutta
  • 1,021
  • 3
  • 16
  • 36
0
votes
0 answers

Mysql str_to_date with convert_tz returns NULL

The following MYSQL query returns a date as expected: select str_to_date('Thu, 13 May 2021 10:40:00 +0000', '%a, %d %b %Y %H:%i:%s +0000') the_date; +---------------------+ | the_date | +---------------------+ |…
TenG
  • 3,843
  • 2
  • 25
  • 42
0
votes
1 answer

Incorrect datetime value loading data into MySQL from file with str_to_date function

This is driving me crazy, trying this for 2 days, looking here and in mysql documentation without succes. I have a file with this data: Test,String 1,Completed,full,04/20/21 12:10:01,1618913401 Test,String 2,Completed,full,04/20/21…
mcflurry
  • 1
  • 3
0
votes
2 answers

Trouble running MySQL REGEXP_SUBSTR within STR_TO_DATE to extract date from text

I'm having trouble running MySQL REGEXP_SUBSTR within STR_TO_DATE to extract a date from a text field. If can run the following query, and use REGEXP_SUBSTR to properly extract the date string. SELECT REGEXP_SUBSTR('12/9/97 - Ependymoma!',…
jayurbain
  • 429
  • 1
  • 5
  • 11
0
votes
0 answers

MySQL Function Trigger creation

**I need to create a Function in Mysql that needs to have 2 parameters type TEXT that needs to format the date and time in MySQL format for all the lines from a .txt file. EX from the .txt…