Questions tagged [str-to-date]

123 questions
0
votes
1 answer

php/mysql routine to help me extract all dates strings stored in a column as text dd/mm/yyyy into another fresh column with mysql date datatype

i am new here and i need help with writing a php/mysql routine to help me extract all dates strings stored in a column as text in this format dd/mm/yyyy into another fresh column with mysql date datatype in the format yyyy-mm-dd. i have tried to…
handyx
  • 11
  • 2
0
votes
1 answer

wordpress - Sortable custom fields columns

I added some custom fields (dates) in my admin columns. I try to make them sortable but in order to do that I need to convert them from string to date. My naive and simple code obviously doesn't work... Can someone point out my error(s)…
Nikos
  • 15
  • 4
0
votes
2 answers

MySQL STR_TO_DATE() returns invalid date

Our website requires signing up. Lately it has become apparent that the signup process fails on many occasions. I implemented several logs in my PHP code to start tracking this. Including one to track outputs from mysql_last_error() when…
RonyHe
  • 598
  • 6
  • 9
0
votes
1 answer

Mysql str_to_date does nothing

I have a datecreated field in my database which is of type varchar. Unfortunately I cannot change this field to a date format, so I have to do it when selecting the data. I am trying to sort the records according to date (so that the latest year…
Janpan
  • 1,726
  • 1
  • 19
  • 48
0
votes
2 answers

Write This Query in Codeigniter

I need a little assistance. I need this query SELECT *, STR_TO_DATE( end_date, "%d/%m/%Y" ) AS DATE FROM `resume_experience` WHERE `resume_id` =1 ORDER BY DATE DESC to be written in codeigniter active record format. This is what I…
Omicans
  • 521
  • 6
  • 22
0
votes
1 answer

Convert MySQL text string with time to date

I'm trying to convert a date string with time (stored in a varchar field) to a date format. The current strings are in this format: December 23, 2010 13:57 What I need them to be converted to is a standard date format without the time:…
codemaze
  • 17
  • 6
0
votes
0 answers

STR_TO_DATE returns null in terminal, mysql

I have a problem. wrote a file loader load data local infile '/home/streamsadmin/LandingZone/Susbet/Data/Bets/bets_0.txt' into table bet_temp FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY ',' lines terminated by '\n' ignore 1…
0
votes
2 answers

How Do I Calculate the Number of the Following Week?

I need to calculate the number of the week following a given week. This is trivial for most weeks within the year, but not at the end / beginning of the year. For example if I need to know the week following week 52 of 2013. I would like to use the…
-1
votes
2 answers

'Truncated incorrect Value' error while inserting text as date using str_to_date()

I am looking for a query resolution for one of insert scenarios in MySQL. Below is the scenario: create table test (test_date date); insert into test values (str_to_date('16/04/1991','%d/%m/%y')) MySQL is not allowing me to insert this record and…
-1
votes
1 answer

str to date query (MySQL)

In MySQL am getting error for above. Error is : Incorrect datetime value '31/July/2018' for function str to date Update mytable set Date1 = STR_TO_DATE('31/July/2018', '%d/%b/%Y') where 'Date' IS NOT NULL; Need help with what could be wrong with…
user10319580
  • 11
  • 1
  • 1
-1
votes
1 answer

MySQL str_to_date time conversion fails

I have the following statement that in other installations of MySQL appeared to work fine and return a TIME, while now returns a NULL (which, according to documentation, implies a conversion failure): mysql> select STR_TO_DATE('17:54:23',…
Andrea Aime
  • 1,276
  • 9
  • 15
-1
votes
1 answer

what is wrong with this query using str_to-date function?

SELECT STR_TO_DATE(SUBSTRING_INDEX(`REPORTDATETIME`,' ',1),'%m/%d/%y') FROM crimes where REPORTDATETIME like '%1/12/2001%' it is the query which iam using reportdatetime(varchar) is the column name of table reportdatetime 1/12/2001…
usama mirza
  • 1
  • 1
  • 1
-1
votes
1 answer

Unable to convert string to date time in MySQL query

I am working on a project where I have two tables-one is tbllessontopic which saves unique lesson plans and another table tbllessonperiodallocation which saves dates for which the lesson plan will be taught.Now I have applied the query to get all…
rupinder18
  • 735
  • 1
  • 14
  • 38
-2
votes
2 answers

I: am trying to use STR_TO_DATE but why does this return null?

INSERT INTO covernote (issue_date) VALUES ( STR_TO_DATE ( '13-May-13','%Y-%m-%d') );
ortan
  • 1
  • 1
-2
votes
2 answers

mysql date conversion returns null converting certain months

I have this query (take a look on between dates): SELECT user_name, COUNT(*) AS 'COUNT' FROM user_records WHERE date_created between (STR_TO_DATE('11/24/2020','%m/%d/%y')) and (STR_TO_DATE('12/26/2021','%m/%d/%y')) GROUP BY…
1 2 3
8
9