I have looked up different answers on similar question before posting it here.
So i have a table with user id and date column
I would like to store the results of select query to a temporary table.
On using the below statement:
Create Temporary table dummy_table (
select User_Id , DATE_FORMAT(Date
,'%M %Y')
from result_table.user_signup_date );
throws error
Error Code: 1292. Truncated incorrect datetime value: '2019-06-16 00:00:00 UTC'
I noticed the error occurs only when i format date column. I tried converting date to string. I also tried with str_to_date(DATE_FORMAT(Date
,'%M %Y') ,'%M %Y %H:%i:%s') and few more syntaxes but with no result.
I am new to Sql. Any help would be appreciated. Thanks in advance
Best Answer
From the looks of the error message, the
UTC
should not be part of thedate
. My guess is thatdate
is not using theDATETIME
orTIMESTAMP
data type. It must be a string.Try running it like this :
The expression
LEFT(Date,19)
will drop off the everything after the timestamp.