Date and time columns from the database in the model

I noticed that Date and time columns are taken as string in my models (properties) will that not have effect on query(bring error when quering the DB) and validating the object?should i change the string to correspondant type(date and time, boolean…) ? what can I do for that?


Sorry - I’m not sure if I understand your question.

How exactly does your DB field look like?

How exactly does your Model look like?

Are you talking about unix-timestamps?

Are this "date and time" fields handled automatically by a behavior?

Or handled handled / inputted by end-users?

Usually the timestamp-fields in DB are int(11).


The fields in the database are datetime,date and time; the user is the one who will input those values, after generation of the model by Gii they are of string type, All I need is them to be recognized like in their native type of DB and to be validate in their native type.

So my question is there a way of leting the php script in the model know that the field is a date or time or datetime type? so that it can be validate and well store in DB?