Questions tagged [str-to-date]

123 questions
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.
  • 35
  • 5
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…
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

STR_TO_DATE with timezone

I my MySQL (version 5.7.25) database there's have a column, which is full of varchar(100) dates like Fri May 04 08:08:42 UTC 2018. I need to convert them to date. So far I've came up with SELECT STR_TO_DATE('Fri May 04 08:08:42 UTC 2018', '%a %b %d…
htshame
  • 4,702
  • 3
  • 22
  • 41
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,227
  • 3
  • 29
  • 49
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.…
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,151
  • 1
  • 17
  • 40
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
  • 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
  • 7
1
vote
1 answer

Null Values Using STR_TO_DATE() MySQL

For whatever reason, certain dates return null when using STR_TO_DATE() whereas others don't. CREATE TABLE persons ( personid int, name varchar(100), dob date; insert into persons values (5,"Gov","1985-04-23"), (1,"Gov","1993-04-23"),…
Govind Rai
  • 10,062
  • 7
  • 54
  • 74
1
vote
1 answer

Error Code: 1411. Incorrect datetime value: '0000-00-00' for function str_to_date

I'm trying to change the format of a date from a CSV file before insert. I created a trigger BEFORE INSERT but it doesn't seem to work. CREATE TABLE items ( item_id int(11) NOT NULL AUTO_INCREMENT, price_list_id int(11) NOT NULL, sku…
GeniusMile
  • 13
  • 1
  • 4
1
vote
1 answer

How to convert varchar to a date in php mysql?

I have in my database a date fetcha_pago in the format: "08-Abr-2016" and it is a varchar. When I do the following: STR_TO_DATE(fecha_pago, '%d-%M-%Y') It does not work because the date is in Spanish. It has to be "Apr" instead of "Abr". Is there…
1
vote
2 answers

Why this query is returning empty rows?

I have data in this format CREATE TABLE IF NOT EXISTS `historical_data` ( `symbol_name` varchar(70) DEFAULT NULL, `current_day` varchar(50) DEFAULT NULL, `open_val` varchar(20) DEFAULT NULL, `high_val` varchar(20) DEFAULT NULL, `low_val`…
Pawan
  • 28,159
  • 84
  • 232
  • 394
1
vote
1 answer

How do you correctly use multiple instances of str_to_date with MySQL insert statement?

I am trying to insert 2 dates in UK format (dd/mm/yyyy) to a MySQL database in the MySQL US date format. I am using str_to_date. The first instance of str_to_date works as expected, but the second instance always inserts the same date as the first…
Syn
  • 331
  • 1
  • 13
1
vote
1 answer

MySQL Database Error: Incorrect datetime value: '2015/06/08' for function str_to_date

I'm trying to insert a date from a string in another table. The SELECT statement provides no error while the INSERT statement provides the error "Incorrect datetime value: '2015/06/08' for function str_to_date" The data in the 1CON field is…
1
2
3
8 9