I have a query that pulls the correct data form a db, but it does not return me the month from the timestamp. In the timestamp column I get a null value, even though the tim
You need to convert the timestamp back to a date first, before you can apply the MONTH()
function.
MONTH(mdl_quiz_grades.timemodified)
becomes
MONTH(FROM_UNIXTIME(mdl_quiz_grades.timemodified))
Read more about it here.
And as a sidenote, int
is enough for a timestamp, bigint
is not necessary. A timestamp is a 32bit number, that's why it can hold the maximum date of January 19, 2038.
"SELECT count(*) as records FROM sms WHERE MONTH(tarih)=MONTH(NOW()) and ceptel='"&ceptel&"'"