duanli8391 2017-04-05 09:42
浏览 38


I need to create a form field where the user can input a time in the week. For example "At 8:00 AM on Tuesday". I tried using a DateTimeType form field but can't seem to get it to do what I need.

Is there a way to do this using stock Symfony fields or do I need to create a custom form field type?

More specifically, I tried using DateTimeType and changing the 'date_format' option so it would only have weekday, hour and minute. The documentation links this page for the date/time format. So I used the string 'EEE H:M', only to get an exception saying that 'E' is not valid in the format.

  • 写回答

1条回答 默认 最新

  • douhan8581 2017-04-05 12:24

    A datetime represents specific date and time, so it is not what you want.

    I guess you go better with a select of days and one with times

    and you could store the info combined in one field maybe $dayofweek."_".$time

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥18 深度学习tensorflow1,ssdv1,coco数据集训练一个模型
  • ¥100 关于注册表摄像头和麦克风的问题
  • ¥30 代码本地运行正常,但是TOMCAT部署时闪退
  • ¥15 关于#python#的问题
  • ¥15 主机可以ping通路由器但是连不上网怎么办
  • ¥15 数据库一张以时间排好序的表中,找出多次相邻的那些行
  • ¥50 关于DynamoRIO处理多线程程序时候的问题
  • ¥15 kubeadm部署k8s出错
  • ¥15 Abaqus打不开cae文件怎么办?
  • ¥15 小程序准备上线,软件开发公司需要提供哪些资料给甲方