diff --git a/components/time.inc b/components/time.inc
index 7a6f896..9f8c20c 100644
--- a/components/time.inc
+++ b/components/time.inc
@@ -22,6 +22,9 @@ function _webform_defaults_time() {
     'extra' => array(
       'timezone' => 'user',
       'hourformat' => '12-hour',
+      'hours_available_24' => range(1, 24),
+      'hours_available_12am' => range(1, 12),
+      'hours_available_12pm' => range(1, 12),
       'minuteincrements' => 1,
       'title_display' => 0,
       'description' => '',
@@ -78,6 +81,45 @@ function _webform_edit_time($component) {
     '#weight' => 2,
     '#parents' => array('extra', 'hourformat'),
   );
+  $form['display']['hours_available_24'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Hours available'),
+    '#default_value' => $component['extra']['hours_available_24'],
+    '#options' => array_replace(array('all' => t('Select all')), array_combine(range(1, 24), range(0, 23))),
+    '#attributes' => array(
+      'class' => array(
+        'clearfix hours-set hours-set-24'
+      ),
+    ),
+    '#weight' => 3,
+    '#parents' => array('extra', 'hours_available_24'),
+  );
+  $form['display']['hours_available_12am'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Hours available a.m.'),
+    '#default_value' => $component['extra']['hours_available_12am'],
+    '#options' => array_replace(array('all' => t('Select all')), array_combine(range(1, 12), range(1, 12))),
+    '#attributes' => array(
+      'class' => array(
+        'clearfix hours-set hours-set-12 hours-set-12am'
+      ),
+    ),
+    '#weight' => 4,
+    '#parents' => array('extra', 'hours_available_12am'),
+  );
+  $form['display']['hours_available_12pm'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Hours available p.m.'),
+    '#default_value' => $component['extra']['hours_available_12pm'],
+    '#options' => array_replace(array('all' => t('Select all')), array_combine(range(1, 12), range(1, 12))),
+    '#attributes' => array(
+      'class' => array(
+        'clearfix hours-set hours-set-12 hours-set-12pm'
+      ),
+    ),
+    '#weight' => 5,
+    '#parents' => array('extra', 'hours_available_12pm'),
+  );
   $form['display']['minuteincrements'] = array(
     '#type' => 'select',
     '#title' => t('Minute increments'),
@@ -89,7 +131,7 @@ function _webform_edit_time($component) {
       15 => t('15 minute'),
       30 => t('30 minute'),
     ),
-    '#weight' => 3,
+    '#weight' => 6,
     '#parents' => array('extra', 'minuteincrements'),
   );
   return $form;
@@ -110,6 +152,9 @@ function _webform_render_time($component, $value = NULL, $filter = TRUE) {
     '#description' => $filter ? webform_filter_descriptions($component['extra']['description'], $node) : $component['extra']['description'],
     '#element_validate' => array('webform_validate_time'),
     '#hourformat' => $component['extra']['hourformat'],
+    '#hours_available_24' => $component['extra']['hours_available_24'],
+    '#hours_available_12am' => $component['extra']['hours_available_12am'],
+    '#hours_available_12pm' => $component['extra']['hours_available_12pm'],
     '#minuteincrements' => $component['extra']['minuteincrements'],
     '#default_value' => $filter ? webform_replace_tokens($component['value'], $node) : $component['value'],
     '#timezone' => $component['extra']['timezone'],
@@ -128,6 +173,18 @@ function _webform_render_time($component, $value = NULL, $filter = TRUE) {
 }
 
 /**
+ * Webform prepeare 12-hour format hours to display from hours sets.
+ */
+function _webform_prepeare_ampm_hours($element, $ampm) {
+  $hours_available_12_values = array_filter($element['#hours_available_12'.$ampm]);
+  $hours_available_12_keys = Array();
+  foreach ($hours_available_12_values as $hours_available_12_value) {
+    $hours_available_12_keys[] = $hours_available_12_value.$ampm;
+  }
+  return array_combine($hours_available_12_keys, $hours_available_12_values);
+}
+
+/**
  * Form API #process function for Webform time fields.
  */
 function webform_expand_time($element) {
@@ -163,9 +220,20 @@ function webform_expand_time($element) {
   // Generate the choices for drop-down selects.
   $hours[''] = t('hour');
   $minutes[''] = t('minute');
-  for ($i = $first_hour; $i <= $last_hour; $i++) {
-    $hours[$i] = $i;
+  if ($element['#hourformat'] == '12-hour') {
+    $hours_available_12am = _webform_prepeare_ampm_hours($element, 'am');
+    $hours_available_12pm = _webform_prepeare_ampm_hours($element, 'pm');
+    $hours = array_merge($hours, $hours_available_12am, $hours_available_12pm);
   }
+  else {
+    $hours_available_24_set = array_filter($element['#hours_available_24']);
+    $hours_available_24 = array();
+    foreach ($hours_available_24_set as $hour_available) {
+      $hours_available_24[] = $hour_available - 1;
+    }
+    $hours = array_merge($hours, $hours_available_24);
+  }
+
   for ($i = 0; $i <= 59; $i += $element['#minuteincrements']) {
     $minutes[$i] = $i < 10 ? "0$i" : $i;
   }
diff --git a/css/webform-admin.css b/css/webform-admin.css
index 520a86c..f34a1f5 100644
--- a/css/webform-admin.css
+++ b/css/webform-admin.css
@@ -151,6 +151,22 @@ tr.webform-add-form .tabledrag-changed {
   background-color: inherit;
 }
 
+/* Time component hours set styling */
+#webform-component-edit-form .form-type-checkboxes > .hours-set {
+  width: 450px;
+}
+#webform-component-edit-form .hours-set div.form-item-extra-hours-available-24-all,
+#webform-component-edit-form .hours-set div.form-item-extra-hours-available-12am-all,
+#webform-component-edit-form .hours-set div.form-item-extra-hours-available-12pm-all {
+  clear: both;
+  float: none;
+  width: auto;
+}
+#webform-component-edit-form .hours-set > div {
+  float: left;
+  width: 35px;
+}
+
 /* E-mail configuration */
 html.js .webform-email-mapping {
   display: none;
diff --git a/js/webform-admin.js b/js/webform-admin.js
index 2050649..b869ab8 100644
--- a/js/webform-admin.js
+++ b/js/webform-admin.js
@@ -21,6 +21,12 @@ Drupal.behaviors.webformAdmin.attach = function(context) {
   // Trigger radio/checkbox change when label click automatically selected by
   // browser.
   Drupal.webform.radioLabelAutoClick(context);
+  // Hide or display hours set in time component.
+  Drupal.webform.hoursFormatSetAvailable(context);
+  // Hide or display hourse set dynamically when time format changed.
+  Drupal.webform.hoursFormatSwitch(context);
+  // Select or deselect hours in set.
+  Drupal.webform.hoursSelectDeselect(context);
 }
 
 Drupal.webform = Drupal.webform || {};
@@ -342,4 +348,70 @@ Drupal.webform.radioLabelAutoClick = function(context) {
   });
 }
 
+/**
+ * Attach behaviors for hide or display hours set in time component.
+ *
+ * Hide or display hours sets for 12-hour (am/pm) format or 24 hour format.
+ */
+Drupal.webform.hoursFormatSetAvailable = function(context) {
+  if ($('#webform-component-edit-form .hours-set').length > 0) {
+    // Add form item wrappers.
+    $('.form-type-checkboxes > .hours-set').parent('.form-type-checkboxes').once('hours-set-wrapper').addClass('hours-set-wrapper');
+    $('.hours-set-wrapper').hide();
+    // Show proper set.
+    if ($('.form-item-extra-hourformat .form-radio:checked').val() == '12-hour') {
+      $('.form-item-extra-hours-available-12am, .form-item-extra-hours-available-12pm').show();
+    }
+    else {
+      $('.form-item-extra-hours-available-24').show();
+    }
+  }
+}
+
+/**
+ * Event callback to switch hours format.
+ *
+ * Call behaviour function to show or hide hours set.
+ * This function discard inappropriate values for 12-hour format.
+ */
+Drupal.webform.hoursFormatSwitch = function(context) {
+  if ($('#webform-component-edit-form .hours-set').length > 0) {
+    $('.form-item-extra-hourformat .form-radio').change(function() {
+      if ($(this).is(':checked')) {
+        // Show or hide available hours.
+        Drupal.webform.hoursFormatSetAvailable(context);
+      }
+    });
+  }
+}
+
+/**
+ * Event callback to select/deselect all hours in set.
+ *
+ */
+Drupal.webform.hoursSelectDeselect = function(context) {
+  if ($('#webform-component-edit-form .hours-set').length > 0) {
+    // Check all checkboxes in set via "Select all".
+    $('.hours-set input[type=checkbox][value=all]').change(function() {
+      if ($(this).is(':checked')) {
+        $(this).parents('.hours-set').find('input[type=checkbox]:not([value=all])').prop('checked', true);
+      }
+      else {
+        $(this).parents('.hours-set').find('input[type=checkbox]:not([value=all])').prop('checked', false);
+      }
+    });
+    // Check/uncheck "Select all" checkbox if checkbox in set changed.
+    $('.hours-set input[type=checkbox]:not([value=all])').change(function () {
+      var checkboxCountAll = $(this).parents('.hours-set').find('input[type=checkbox]:not([value=all])').length;
+      var checkboxCountChecked = $(this).parents('.hours-set').find('input[type=checkbox]:not([value=all]):checked').length;
+      if (checkboxCountAll != checkboxCountChecked) {
+        $(this).parents('.hours-set').find('input[type=checkbox][value=all]').prop('checked', false);
+      }
+      else {
+        $(this).parents('.hours-set').find('input[type=checkbox][value=all]').prop('checked', true);
+      }
+    });
+  }
+}
+
 })(jQuery);
diff --git a/js/webform.js b/js/webform.js
index e93a4fb..927d113 100644
--- a/js/webform.js
+++ b/js/webform.js
@@ -11,6 +11,9 @@ Drupal.behaviors.webform.attach = function(context) {
   // Calendar datepicker behavior.
   Drupal.webform.datepicker(context);
 
+  // Display select values depending on am or pm selected.
+  Drupal.webform.timeHoursSetDisplay(context);
+
   // Conditional logic.
   if (Drupal.settings.webform && Drupal.settings.webform.conditionals) {
     Drupal.webform.conditional(context);
@@ -88,6 +91,24 @@ Drupal.webform.datepicker = function(context) {
   });
 };
 
+// Display hours values depend on selected am or pm.
+Drupal.webform.timeHoursSetDisplay = function(context) {
+  if ($('.webform-component-time .form-radios').length > 0) {
+    var webform_ampm_time = $('.webform-component-time .form-radios').parents('.webform-component-time');
+    webform_ampm_time.find('.hour.form-select option').hide();
+    var checkedHourFormat = webform_ampm_time.find('.form-radios input[type=radio]:checked').val();
+    webform_ampm_time.find('.hour.form-select option[value*='+checkedHourFormat+']').show();
+
+    webform_ampm_time.find('.form-radios input[type=radio]').change(function() {
+      if ($(this).is(':checked')) {
+        webform_ampm_time.find('.hour.form-select option').hide();
+        webform_ampm_time.find('.hour.form-select option[value*='+$(this).val()+']').show();
+      }
+    });
+  }
+
+}
+
 Drupal.webform.conditional = function(context) {
   // Add the bindings to each webform on the page.
   $.each(Drupal.settings.webform.conditionals, function(formKey, settings) {
