PHP code example of alexvasilyev / datetimepicker-bundle

1. Go to this page and download the library: Download alexvasilyev/datetimepicker-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alexvasilyev / datetimepicker-bundle example snippets

bash
php composer.phar update stephanecollot/datetimepicker-bundle
 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new SC\DatetimepickerBundle\SCDatetimepickerBundle(),
    );
}
 php

// config/bundles.php
return [
        // ...
        SC\DatetimepickerBundle\SCDatetimepickerBundle::class => ['all' => true],
];
 php

// ...
use SC\DatetimepickerBundle\Form\Type\DatetimeType;

public function buildForm(FormBuilder $builder, array $options)
{
    $builder
        // defaut options
        ->add('createdAt', DatetimeType::class)
        
        // full options
        ->add('updatedAt', DatetimeType::class, array( 'pickerOptions' =>
            array('format' => 'mm/dd/yyyy',
                'weekStart' => 0,
                'startDate' => date('m/d/Y'), //example
                'endDate' => '01/01/3000', //example
                'daysOfWeekDisabled' => '0,6', //example
                'autoclose' => false,
                'startView' => 'month',
                'minView' => 'hour',
                'maxView' => 'decade',
                'todayBtn' => false,
                'todayHighlight' => false,
                'keyboardNavigation' => true,
                'language' => 'en',
                'forceParse' => true,
                'minuteStep' => 5,
                'pickerReferer ' => 'default', //deprecated
                'pickerPosition' => 'bottom-right',
                'viewSelect' => 'hour',
                'showMeridian' => false,
                'initialDate' => date('m/d/Y', 1577836800), //example
                ))) ; 

}
 php MM