Questions tagged [str-to-date]
139 questions
2
votes
4 answers
Conditional str_to_date() if format is of one type, else do nothing
I have a table with dates, some of which have this format 31-DEC-2010 while others have this format 2011-01-13.
I am trying to get all them having the date format, using the str_to_date() function, but it fails since it can not convert 2011-01-13…

adrCoder
- 3,145
- 4
- 31
- 56
2
votes
3 answers
mysql DATE_FORMAT STR_TO_DATE date subquery
Here is the RECORDS MySQL TABLE:
ID - BIGINT(20)
DATE - DATE
Records:
ID Date
1 2014-03-01
2 2014-03-02
3 2014-04-01
4 2014-04-02
Here is the first Query:
SELECT id, DATE_FORMAT(date,'%d/%m/%Y') AS date FROM records
WHERE
date >=…

eXtreme
- 244
- 3
- 18
2
votes
5 answers
SQL Statement Convert it to 1 to Jan, 2 to Feb and so on
As you seen the image below, the month is now 1 and 2. How can I convert it to 1 to Jan, 2 to Feb and so on. Below are my sql.
Help will be appreciate. Thanks in advance! :)
SELECT DISTINCT fbmenuname,
Sum(quantity) …

newbieinjavaversion2
- 489
- 5
- 12
- 23
1
vote
1 answer
How to update a MYSQL table column from Varchar data type to a time
I have a table in an MYSQL database and one of the columns (Incident_Time) has values such as 03:15 A and 12:30 P stored as varchar data type. However, I would like to change the data type from varchar to timestamp (time) so that the values can be…

Lonestar101
- 33
- 4
1
vote
2 answers
spark to_date function - how to convert 31-DEC-98 to 1998-12-31 not 2098-12-31
(Py)Spark to_date convert 31-DEC-98 to 2098-12-31. Is there a way to make it 1998-12-31?
The document does not have an option to select 1000 or 2000.
to_date
to_date(date_str[, fmt]) - Parses the date_str expression with the fmt expression to a…

mon
- 18,789
- 22
- 112
- 205
1
vote
2 answers
Query for daily before 11am with MySQL
I have a datetime field and want to get all entries before 11am. It is for an online store where you can order until 11:00am and it will be shipped the same day.
SELECT *
FROM Tablename
WHERE (order.date_added < STR_TO_DATE(YEAR(), MONTH(),…

Alf Müller
- 23
- 5
1
vote
3 answers
Incorrect parameter count in the call to native function 'str_to_date'
There is a table tab1:
|creation_date | acc_num | status|
|-------------------|---------------------|-------|
|31.03.2021 07:43:43| 11111111111111111111| deny |
|31.03.2021 07:43:43| 11111111111111111111| deny |
|31.03.2021…

Vadim.M.
- 75
- 7
1
vote
1 answer
Dates not importing correctly
I know similar questions have been posted before, but when I try to follow similar approaches as per the suggestions in the comments, it simply does not help. My query is the following:
LOAD DATA INFILE 'File.txt'
IGNORE
INTO TABLE table_name
FIELDS…

Jesus Rodriguez
- 137
- 7
1
vote
1 answer
Insert / Convert date from: C++ To mySQL db
I'm a beginner in c++, this is part of my Task for an interview. Everything else works fine, except that I don't know how to convert String to Date, when it comes to pass the record to the database. Or just pass date (or DateTime) to the database. I…

zolee1337
- 13
- 2
1
vote
1 answer
How to convert Varchar Date Value into Date Data Type in MySQL using Case When and Str_to Date
I have a list of dates in a table that currently holds that column as a Varchar data type. What I am looking to do is clean up this table and the first step is to convert this column into a Date Data Type and convert the values that I have to all be…

Michael Owen
- 365
- 3
- 20
1
vote
1 answer
MariaDB: How to consider local date format with STR_TO_DATE?
I have a csv file which I want to load into a table. It has a column with the following date format:
'%d-%b-%y'
For example: '01-Dez-18'. If I load this file considering the format:
IF(@entry_dt = '',NULL,STR_TO_DATE(@entry_dt, '%d-%b-%y'))
I get…

giordano
- 2,954
- 7
- 35
- 57
1
vote
4 answers
MySQL concat year month date colums to date column in same table
I have a table 'setlists' in mysql with columns 'year' 'month' 'day' of int type that I would like to str_to_date and concat into a new column 'date' in the same table. This is what I have so far but I cant seem to get the syntax right. It wont run.…

Brent Vaalburg
- 119
- 2
- 11
1
vote
0 answers
Laravel 5.4, mysql 5.6.35 empty result when using STR_TO_DATE in where clause
I get empty result in eloquent query builder, whereas copying the sql (from ->toSql( ) function) and run it in phpadmin works perfectly.
This is my…

4givN
- 2,936
- 2
- 22
- 51
1
vote
1 answer
Update DATE in tables stored as VARCHAR after conversion
I imported data from Excel and brought dates over in VARCHAR format as 03/24/2017 because the dates were not saving. So I used VARCHAR for expediency. Now I am paying the price.
I am trying to use the STR_TO_DATE function to convert so that I can…

Bricked
- 115
- 1
- 11
1
vote
1 answer
How to Convert 2 Strings To Date in MySQL
i have a table tbl_remit.
________________________________________________________________
|RemitNo|ID|Employer|From_Month|From_Year|To_Month|To_Year|Amount|
| 1 |1 | a | 01 | 2016 | 01 | 2016 |200.00|
| 2 |1 | a | …

Clorae
- 73
- 8