You are here

function cmfcCalendarV1Thai::date in Calendar Systems 6

Same name and namespace in other branches
  1. 8 calendar/v1/calendarSystems/thai.class.inc.php \cmfcCalendarV1Thai::date()
  2. 8.2 calendar/v1/calendarSystems/thai.class.inc.php \cmfcCalendarV1Thai::date()
  3. 7 calendar/v1/calendarSystems/thai.class.inc.php \cmfcCalendarV1Thai::date()
  4. 7.2 calendar/v1/calendarSystems/thai.class.inc.php \cmfcCalendarV1Thai::date()
1 call to cmfcCalendarV1Thai::date()
cmfcCalendarV1Thai::timestampToStr in calendar/v1/calendarSystems/thai.class.inc.php

File

calendar/v1/calendarSystems/thai.class.inc.php, line 114

Class

cmfcCalendarV1Thai

Code

function date($format, $timestamp) {
  if (is_null($timestamp) || $timestamp == '') {
    $timestamp = $this
      ->phpTime();
  }
  $value = gmdate($format, $timestamp);
  switch ($format) {
    case 'D':
      $output = $this
        ->getWeekShortName(gmdate('w', $timestamp));
      break;
    case 'l':
      $output = $this
        ->getWeekName(gmdate('w', $timestamp));
      break;
    case 'S':
      $output = '';

      /* In Thai has no suffix.*/
      break;
    case 'F':
      $output = $this
        ->getMonthName(gmdate('n', $timestamp));
      break;
    case 'M':
      $output = $this
        ->getMonthShortName(gmdate('n', $timestamp));
      break;
    case 'Y':
      $output = $value + 543;
      break;
    case 'y':
      $output = (string) $value + 543;
      $output = substr($output, strlen($output) - 2);
      break;
    case 'U':
      $output = $this
        ->phpTime();
      break;
    default:
      $output = gmdate($format, $timestamp);
      break;
  }
  return $output;
}