Last active
December 14, 2015 02:19
-
-
Save whitewhidow/5013082 to your computer and use it in GitHub Desktop.
datime with timepicker in symfony2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////// in template | |
<style> | |
/* css for timepicker */ | |
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } | |
.ui-timepicker-div dl { text-align: left; } | |
.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } | |
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } | |
.ui-timepicker-div td { font-size: 90%; } | |
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; } | |
.ui-timepicker-rtl{ direction: rtl; } | |
.ui-timepicker-rtl dl { text-align: right; } | |
.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; } | |
</style> | |
<script> | |
jQuery(window).load(function() { | |
jQuery( "#LessonEdit_startDate" ).datetimepicker({ | |
timeFormat: 'hh:mm:ss', | |
dateFormat: 'yy-mm-dd', | |
controlType: 'select' | |
}); | |
}); | |
</script> | |
/////////// in formtype | |
->add('startDate', 'datetime', array('label' => 'date', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd hh:mm:ss')) | |
//////////////////// in entity | |
/** | |
* @ORM\Column(type="datetime", name="startDate") | |
* | |
* @var DateTime $startDate | |
*/ | |
protected $startDate; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment