簡體   English   中英

symfony 1.4 和 doctrine 1.2 中的短時間戳

[英]short timestamp in symfony 1.4 and doctrine 1.2

我在 Symfony 中生成了新項目,並使用了 Doctrine:

expires_at:   { type: timestamp, notnull: true }

但這對我來說太長了。 我只需要 2011/06/05。 我怎樣才能做到這一點? 表單中的小部件要求太多。 還必須填寫例如毫秒。

這個:

unset(
  $this['expires_at']
);

刪除了小部件中的所有字段。 我希望在 2011 年 6 月 5 日保持這樣的狀態。

doctrine 具有用於此目的的特殊數據類型: http://www.doctrine-project.org/documentation/manual/1_2/pl/defining-models:columns:data-types#date

把它放在你的 schema.yml 中:

expires_at:   { type: date, notnull: true }

並重新生成您的表單。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM