Questions tagged [str-to-date]
139 questions
0
votes
1 answer
Different behavior of str_to_date in SELECT and INSERT statement
I have the same problem as in this question - MySQL Unable to insert WHERE STR_TO_DATE IS NULL.
I want to migrate dates from one db into another. The dates in the original db are stored as varchars and are not always valid - for example sometimes…

apmyp1990
- 21
- 7
0
votes
1 answer
Use STR_TO_DATE in sql with year change
I have this query:
$sql = "SELECT * FROM giorni WHERE punto = '$punto' && STR_TO_DATE(giorno, '%d/%m/%Y') ...
I need to do a similar query for the previous year. How can i do %Y-1?

FrancescoElba
- 33
- 1
- 6
0
votes
1 answer
How to load string from flat file into date in target table(Teradata) using informatica?
I am trying to load string from flat file into date in target teradata table using informatica.
But while doing that, my workflow is succeeding but data is not loading into table. When I run the debugger, data is passing through, SQ, expression. …

S.P
- 1,775
- 5
- 14
- 21
0
votes
1 answer
AWS Pipeline CSV to RDS parse error
I am using AWS's data pipeline to import a CSV file on S3 into my MySQL RDS instance and am having trouble with the STR_TO_DATE it seems. I am getting a:
"Parse error: expected field to be terminated by endOfRecord or endOfField but was…

user3511424
- 11
- 6
0
votes
3 answers
STR_TO_DATE in MY SQL Query is Null
I've read multiple posts and find nothing wrong with my syntax, can someone point out the error?
I am testing some queries in PHP MyAdmin, on a WordPress Database. The table I am querying has a meta_key of "Listing-End-Date" and meta_values of…

Lisa Baird
- 33
- 7
0
votes
0 answers
mySQL two date formats in one column
I have a table with amongst others the following column:
CREATE TABLE `tweets` (
(...)
`timestamp` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
(...)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
within this column I have two different…

GreenPirate
- 37
- 8
0
votes
1 answer
Convert CHAR to date in mysql
I am trying to compare a year stored as CHAR(4) to a year stored as DATETIME, but every time I try to convert the CHAR year to a date, I always get NULL when I expect the year in format 'YYYY'. I've read the formatting for using str_to_date, but I'm…

Brendan O'Sullivan
- 35
- 7
0
votes
2 answers
MySql STR_TO_DATE not working in Stored Procedure
I want to add date from my JSP to mysql database using Servlet, if i write a query then STR_TO_DATE work properly for insertion, but if i use STR_TO_DATE in Stored Procedure it gives me "com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect…

Abrar Ansari
- 127
- 8
0
votes
1 answer
Mysql: Using str_to_date on a select query returns nothing
I've following Mysql query:
select str_to_date((select distinct cast(substr(tb2.sub1,1,4) AS CHAR) as year from (
SELECT SUBSTRING_INDEX(file_name,'_',-1) as sub1 from table2) as tb2) , '%Y')
And it is correct because mysqlworkbench returns green…

Michael
- 1
- 2
0
votes
1 answer
MySQL sorting upon date and time on datetime string
I have a MySQL table with the following schema:
CREATE TABLE `events` (
`id` bigint(20) NOT NULL,
`name` text NOT NULL,
`time` text NOT NULL,
`city` text NOT NULL,
`description` text NOT NULL,
`contact_name` text NOT NULL,
…

Tejashwi Kalp Taru
- 2,994
- 2
- 20
- 35
0
votes
2 answers
Convert different string date, into one single date format In mysql
I have an column create_date in my sql table, datatype is varchar(225). My problem is, in that column values are in different date formats Please check the attached Image
I want to create another column with constant_date_format using create _date…

ansh
- 573
- 3
- 9
- 26
0
votes
2 answers
Inserting date value into MySQL through PHP
What I'm trying to do is as the title implies inserting date into created table.
I've done my research. I considered following topics:
Parse error: syntax error, unexpected T_VARIABLE on line 107
SQL DML: Incorrect date value (MySQL)
and others.…
user7958694
0
votes
1 answer
MySQL STR_TO_DATE hour formatting
I'm trying to format a string containing a time-value with the STR_TO_DATE function. The time value is : hour(0-23) without leading zero + minute (00-59)
e.g. 800, 1245 or 1535. To format these values I tried to use the %k hour specifier as…

Michael
- 116
- 6
0
votes
2 answers
How to convert string to date time format Mysql
I have this file csv:
20170117-00:00:6 3087A6B282A46C 124.191.134.139 2746 256 63628
20170117-00:00:53 330391C9F58B5A 120.18.97.172 2746 257 43077
20170117-00:02:27 3303CD14BD40C8 110.147.131.78 2746 256…

Valerio
- 101
- 2
- 10
0
votes
1 answer
varchar '09/16/2016 17:28:25 IST' to datetime in mysql
I need to convert '09/16/2016 17:28:25 IST' to datetime in mysql. I tried many options but it is returning null.
Tried Options:
select DATE_FORMAT(STR_TO_DATE('09/16/2016 17:28:25 IST', '%d/%m/%Y'), '%Y-%m-%d')
select CAST(LEFT('09/16/2016 17:28:25…

Kanted
- 169
- 1
- 12