I dont really have a problem, but I want to make my code faster and prettier.
I have some tables with DATETIME in it.
They have the std format %Y-%m-%d %H:%i:%s
I need them to be in %d.%m.%Y %H:%i format.
I tried to fix it with the server variable "datetime_forma t".
After reading a lot in mysql doc I found out that:
So Im using
on every query.
After sleeping a night over it I had an idea... Is it possible to write some INSERT/SELECT/UPDATE/ trigger that changes format on every field that is DATETIME?
Or does someone have another idea?
I have some tables with DATETIME in it.
They have the std format %Y-%m-%d %H:%i:%s
I need them to be in %d.%m.%Y %H:%i format.
I tried to fix it with the server variable "datetime_forma t".
After reading a lot in mysql doc I found out that:
datetime_format
This variable is unused.
This variable is unused.
So Im using
Code:
DATE_FORMAT(date,'%d.%m.%Y %H:%i') //on SELECT
STR_TO_DATE(insert,'%Y-%m-%d %H:%i:%s') //on INSERT
After sleeping a night over it I had an idea... Is it possible to write some INSERT/SELECT/UPDATE/ trigger that changes format on every field that is DATETIME?
Or does someone have another idea?
Comment