Get the date format used for the appointment date

@return array
350848
public function getDateFormat()
    {
        $model = $this->getModel();

        $format = $model->get('gap_admission_time', 'dateFormat');
        if (! $format) {
            $format = \MUtil_Model_Bridge_FormBridge::getFixedOption('date', 'dateFormat');
        }

        return $format;
    }
318049
public function getActiveAppointments()
    {
        return $this->business
            ->bookings()->with('contact')
            ->with('business')
            ->with('service')
            ->active()
            ->orderBy('start_at')
            ->get();
    }
904108
private function dateOptions(): array
    {
        return [
            0  => I18N::translate('Exact date'),
            2  => I18N::plural('±%s year', '±%s years', 2, I18N::number(2)),
            5  => I18N::plural('±%s year', '±%s years', 5, I18N::number(5)),
            10 => I18N::plural('±%s year', '±%s years', 10, I18N::number(10)),
        ];
    }
5941
public function getSchedule() {
    // Use cached schedule if already processed.
    if ($this->schedule) {
      return $this->schedule;
    }

    $conf = $this->configFactory->get('openy_group_schedules.settings');
    $days_range = is_numeric($conf->get('days_range')) ? $conf->get('days_range') : 14;

    $filter_date = DrupalDateTime::createFromTimestamp($this->parameters['filter_timestamp'], $this->timezone);
    $current_date = DrupalDateTime::createFromTimestamp(REQUEST_TIME, $this->timezone)->format(GroupexRequestTrait::$dateFilterFormat);
    // Define end date of shown items as 2 weeks.
    $end_date = DrupalDateTime::createFromTimestamp(REQUEST_TIME + 86400 * $days_range, $this->timezone);

    // Prepare classes items.
    $items = [];

    foreach ($this->processedData as $item) {
      // If item date more than 1 week in future skip it.
      $item_date = DrupalDateTime::createFromTimestamp($item->timestamp, $this->timezone);
      if ($item_date > $end_date) {
        continue;
      }
      $class_url_options = $this->parameters;
      // $class_url_options['class'] = $item->class_id; //doesn't exist in API, needs to be added through processData().
      $class_url_options['filter_date'] = $current_date;
      $class_url_options['filter_length'] = 'week';
      $class_url_options['groupex_class'] = 'groupex_table_class_individual';
      $class_url_options['view_mode'] = 'class';
      unset($class_url_options['instructor']);

      $instructor_url_options = $this->parameters;
      $instructor_url_options['filter_date'] = $current_date;
      $instructor_url_options['filter_length'] = 'week';

      $instructor_url_options['instructor'] = $item->instructor;
      // Here we need to remove redundant HTML if exists.
      // Example: Melissa T.<br><span class="fa fa-refresh" aria-hidden="true"></span><span class="sub">Lucy T.</span>
      $pos = strpos($item->instructor, '<span class="sub">');
      if (FALSE !== $pos) {
        $original_instructor = substr_replace($item->instructor, '', 0, $pos);
        $original_instructor = str_replace('<span class="sub">', '', $original_instructor);
        $original_instructor = str_replace('</span>', '', $original_instructor);
        $instructor_url_options['instructor'] = $original_instructor;
      }

      $instructor_url_options['class'] = 'any';
      $instructor_url_options['groupex_class'] = 'groupex_table_instructor_individual';
      unset($instructor_url_options['view_mode']);

      $date_url_options = $this->parameters;
      $date_url_options['filter_date'] = date('m/d/y', strtotime($item->date));
      $date_url_options['filter_length'] = 'day';
      $date_url_options['class'] = 'any';
      $date_url_options['groupex_class'] = 'groupex_table_class';
      unset($date_url_options['instructor']);
      unset($date_url_options['view_mode']);

      $items[$item->id] = [
        '#theme' => isset($this->parameters['groupex_class']) ? $this->parameters['groupex_class'] : 'groupex_class',
        '#class' => [
          'id' => trim($item->id),
          'name' => trim($item->title),
          'group' => trim($item->category),
          'description' => $item->desc,
          'address_1' => $item->address_1,
          'address_2' => trim($item->location),
          'date' => $item->date,
          'studio' => $item->studio,
          'date_short' => date('F, d', strtotime($item->date)),
          'time' => $item->start,
          'duration' => sprintf('%d min', trim($item->length)),
          'instructor' => $item->instructor,
//          'class_id' => $item->class_id, //doesn't exist in API, needs to be added through processData().
          'class_link' => Url::fromRoute('openy_group_schedules.all_schedules_search_results', [], ['query' => $class_url_options]),
          'instructor_link' => Url::fromRoute('openy_group_schedules.all_schedules_search_results', [], ['query' => $instructor_url_options]),
          'date_link' => Url::fromRoute('openy_group_schedules.all_schedules_search_results', [], ['query' => $date_url_options]),
          'calendar' => $item->calendar,
        ],
      ];
    }

    // Pack classes into the schedule.
    $schedule = [];

    // There 3 types of schedules.
    // Day: show classes for single day.
    // Week: show classes for week grouped by day.
    // Location: show classes for 1 day grouped by location.
    $schedule['type'] = isset($this->parameters['filter_length']) ? $this->parameters['filter_length'] : 'day';
    if (!empty($this->parameters['location']) && count($this->parameters['location']) > 1) {
      $schedule['type'] = 'location';
    }
    if (!empty($this->parameters['class']) && is_numeric($this->parameters['class'])) {
      $schedule['type'] = 'week';
    }
    if (!empty($this->parameters['instructor'])) {
      $schedule['type'] = 'instructor';
    }
    switch ($schedule['type']) {
      case 'day':
        $schedule['classes'] = [];
        foreach ($items as $id => $class) {
          $schedule['classes'][] = $class;
          $schedule['title'] = trim($this->enrichedData[$id]->location);
        }
        // Pass 'View This Week’s PDF' href if some location selected.
        if (!empty($this->parameters['location'])) {
          $location_id = $this->parameters['location'];
          $category = $this->parameters['category'] == 'any' ? NULL : $this->parameters['category'];
          $schedule['pdf_href'] = $this->groupexHelper->getPdfLink($location_id, $this->parameters['filter_timestamp'], $category);
        }

        // If no location selected show date instead of title.
        if (empty($this->parameters['location'])) {
          $schedule['title'] = $filter_date->format(GroupexRequestTrait::$dateFullFormat);
        }
        break;

      case 'week':
        $schedule['days'] = [];
        foreach ($items as $id => $class) {
          $schedule['days'][$this->enrichedData[$id]->day]['classes'][] = $class;
          $schedule['days'][$this->enrichedData[$id]->day]['day_short'] = DrupalDateTime::createFromFormat(GroupexRequestTrait::$dateFullFormat, $this->enrichedData[$id]->day, $this->timezone)->format('l, F j');
          $schedule['days'][$this->enrichedData[$id]->day]['date_link'] = $class['#class']['date_link'];
        }
        // Pass 'View This Week’s PDF' href if some location selected.
        if (!empty($this->parameters['location'])) {
          $location = $this->parameters['location'];
          $category = $this->parameters['category'] == 'any' ? NULL : $this->parameters['category'];
          $schedule['pdf_href'] = $this->groupexHelper->getPdfLink($location, $this->parameters['filter_timestamp'], $category);
        }

        // If no location selected show date instead of title.
        if (empty($this->parameters['location'])) {
          $schedule['day'] = $filter_date->format(GroupexRequestTrait::$dateFullFormat);
        }
        break;

      case 'location':
        $schedule['locations'] = [];
        $location_id = NULL;
        $locations_ids = \Drupal::entityQuery('mapping')
          ->condition('type', 'location')
          ->execute();
        $locations = \Drupal::entityManager()->getStorage('mapping')->loadMultiple($locations_ids);
        foreach ($items as $id => $class) {
          $short_location_name = trim($this->enrichedData[$id]->location);
          foreach ($locations as $location) {
            if ($location->get('name')->value == $short_location_name) {
              $field_groupex_id = $location->field_groupex_id->getValue();
              $location_id = isset($field_groupex_id[0]['value']) ? $field_groupex_id[0]['value'] : FALSE;
            }
          }
          $category = $this->parameters['category'] == 'any' ? NULL : $this->parameters['category'];
          $pdf_href = $this->groupexHelper->getPdfLink($location_id, $this->parameters['filter_timestamp'], $category);
          $schedule['locations'][$short_location_name]['classes'][] = $class;
          $schedule['locations'][$short_location_name]['pdf_href'] = $pdf_href;
        }
        $schedule['filter_date'] = date(GroupexRequestTrait::$dateFullFormat, $this->parameters['filter_timestamp']);
        break;

      case 'instructor':
        // Filter classes by instructor.
        $schedule['days'] = [];

        foreach ($items as $id => $class) {
          if ($class['#class']['instructor'] == $this->parameters['instructor']) {
            $class_date = DrupalDateTime::createFromFormat(
              GroupexRequestTrait::$dateFullFormat,
              $this->enrichedData[$id]->day,
              $this->timezone
            );

            $schedule['days'][$this->enrichedData[$id]->day]['classes'][] = $class;
            $schedule['days'][$this->enrichedData[$id]->day]['day_short'] = $class_date->format('l, F j');

            // Adjust query options to fit class date.
            $date_url_options['filter_date'] = $class_date->format(GroupexRequestTrait::$dateFilterFormat);
            $date_url_options['filter_timestamp'] = $class_date->format('U');

            $url = Url::fromRoute('openy_group_schedules.all_schedules_search_results', [], ['query' => $date_url_options]);
            $schedule['days'][$this->enrichedData[$id]->day]['date_link'] = $url;
          }
        }

        $schedule['instructor_location'] = t('Schedule for <span class="name"><span class="icon icon-user"></span>@name</span>', [
          '@name' => reset($schedule['days'])['classes'][0]['#class']['instructor'],
        ]);

        // Pass 'View This Week’s PDF' href if some location selected.
        if (!empty($this->parameters['location'])) {
          $location = $this->parameters['location'];
          $category = $this->parameters['category'] == 'any' ? NULL : $this->parameters['category'];
          $schedule['pdf_href'] = $this->groupexHelper->getPdfLink($location, $this->parameters['filter_timestamp'], $category);
        }

        // If no location selected show date instead of title.
        if (empty($this->parameters['location'])) {
          $schedule['day'] = $filter_date->format(GroupexRequestTrait::$dateFullFormat);
        }
        break;
    }

    $this->schedule = $schedule;
    return $this->schedule;
  }
1332349
protected function getInvoiceDate()
    {
        $date = !empty($this->invoice[Tag::Customer][Tag::Invoice][Tag::IssueDate]) ? $this->invoice[Tag::Customer][Tag::Invoice][Tag::IssueDate] : date(API::DateFormat_Iso);
        return $date;
    }
168810
public function getDates()
    {
        return $this->cache(__FUNCTION__, function () {
            $casts = $this->getCasts();

            $dates = [];

            foreach ($casts as $key => $cast) {
                if ($cast == 'datetime') {
                    $dates[] = $key;
                }
            }

            return $dates;
        });
    }
588615
public function getCallable()
    {
        return function ($format, $timestamp = null) {
            if (is_null($timestamp)) {
                $timestamp = $this->timestamp;
            }
            return \date($format, $timestamp);
        };
    }
727976
public static function date_field_types() {

		static $field_types = null;

		if ( null === $field_types ) {
			$field_types = array( 'date', 'datetime', 'time' );

			$field_types = apply_filters( 'pods_tableless_field_types', $field_types );
		}

		return $field_types;
	}
701655
public function getFormattedExpirationDate()
    {
        $date = $this->model->getExpirationDate();

        if ($date instanceof Carbon) {
            $isFuture   = $date->isFuture();
            $translated = $isFuture ? $date->diffForHumans(null, true) : $date->diffForHumans();

            if ($isFuture) {
                $translated = 'in ' . $translated;
            }

            return $translated;
        }

        return '---';
    }
1083974
static function getDatepickerFormat($in_format)
    {
        $retval = "";
        switch ($in_format) {
            case "d-m-Y":$retval = "dd-mm-yy";
                break;
            case "d/m/Y":$retval = "dd/mm/yy";
                break;
            case "m/d/Y":$retval = "mm/dd/yy";
                break;
            case "m-d-Y":$retval = "mm-dd-yy";
                break;
            case "Y/m/d":$retval = "yy/mm/dd";
                break;
            case "Y-m-d":$retval = "yy-mm-dd";
                break;

            default:
                $retval = "dd/mm/yy";
        }
        return $retval;
    }
78905
public function getTableData()
    {
        $items = FeedbackContactUs::selectRaw('*, DATE_FORMAT(created_at, "%d %b, %Y ") as date')
            ->where('created_at', '>=', $this->inputDateFrom() . '%')
            ->where('created_at', '<=', $this->inputDateTo() . '  23:59:59')
            ->orderBy('created_at')
            ->get();

        return DataTables::of($items)->addColumn('fullname', function ($row) {
            return $row->fullname;
        })->addColumn('date', function ($row) {
            return $row->created_at->format('d M Y');
        })->make(true);
    }
456659
public function getExcludedDates()
    {
        $dates = [];
        foreach ($this->getValue('excludedDates') as $date => $v) {
            $d = \DateTime::createFromFormat('U', $date);

            if ($tz = $this->getTimeZone()) {
                $d->setTimezone($tz);
            }

            $dates[] = $d;
        }

        return $dates;
    }
727080
public function getDates()
    {
        $defaults = [static::CREATED_AT, static::UPDATED_AT, $this->getDeletedAtColumn()];

        return array_merge($this->dates, $defaults);
    }
626036
protected function formatGedcomMonth(): string
    {
        // Our simple lookup table doesn't work correctly for Adar on leap years
        if ($this->month === 7 && $this->calendar instanceof JewishCalendar && !$this->calendar->isLeapYear($this->year)) {
            return 'ADR';
        }

        return array_search($this->month, static::MONTH_ABBREVIATIONS, true);
    }
1370372
public function created_at_formatted()
    {
        return ucfirst($this->dates->make($this->wrappedObject->created_at)->format($this->incidentDateFormat()));
    }
1224156
public function getDisplayString()
    {
        $results[] = $this->getAdmissionTime()->toString($this->agenda->appointmentDisplayFormat);
        $results[] = $this->getActivityDescription();
        $results[] = $this->getProcedureDescription();
        $results[] = $this->getLocationDescription();
        $results[] = $this->getSubject();

        return implode($this->_('; '), array_filter($results));
    }
1151739
public function user_date()
    {
        // get user's timezone
        try {
            $tz   = new DateTimeZone($this->config->get('timezone'));
            $date = new DateTime('now', $tz);
        }
        catch (Exception $e) {
            $date = new DateTime();
        }

        return $date->format('r');
    }