تخطي إلى المحتوى الرئيس

Custom date field not working with format function - قاعدة المعلومات / Developer & Reporting / Creating Reports - Deskpro Support

Custom date field not working with format function

قائمة المؤلفين

Question:

I'm trying to create a report that includes information from a custom date field:

 

SELECT DATE_FORMAT(tickets.custom_data[1]), '%Y-%m-%d') AS 'Date'

 

However, the result table only displays None for that column. How can I fix this?

 

Answer:

Custom date fields contain integer timestamp values, so before you use the DATE_FORMAT function, you first have to convert to real dates using FROM_UNIXTIME:

 

DATE_FORMAT(FROM_UNIXTIME(tickets.custom_data[1]), '%Y-%m-%d') AS 'Date'

مفيد. غير مفيد

وجد 50 من 93 شخص هذه الصفحة مفيدة

أضف تعليق

الرجاء تسجيل الدخول أو التسجيل لتقديم تعليق.

هل تحتاج إلى تذكير بكلمة المرور؟