开发者

Custom time format during edit form->helper

开发者 https://www.devze.com 2023-02-05 13:18 出处:网络
i am having a new question again concerning a cakephp form->input problem. iam having records with time fields which i want to enter in a format like \"18:35\". The timeoption can only be set to \"24\

i am having a new question again concerning a cakephp form->input problem. iam having records with time fields which i want to enter in a format like "18:35". The timeoption can only be set to "24", "12" or "none". At the time i am adding a record it isn't a problem to enter this format. But if i like to edit 开发者_开发百科a record the time is displayed with seconds like "18:35:10". I am not quiet sure how to reformat this to "HH:MM" format, and if there is a cakeish way to do that.

Thx,

cdjw


mysqls time field is HH:MM:SS so either you need to reformat it before displaying it, or use char(5) as the field type.

The reformatting option could be done in afterFind() of the model/behavior

0

精彩评论

暂无评论...
验证码 换一张
取 消